html - Html to Pdf Format Angular
问题描述
Hello i want to convert from html to pdf format and send it as a file to my backend, so i can save it in my server, i tried using jspdf but its not working
SendMail() {
var doc = new jspdf();
doc.fromHTML('<h1>Hello World!</h1>', 20, 20);
var blob = new Blob([doc.output("blob")], { type: "application/pdf" });
let lruta = 'report/' + 'test';
this.uploaderService.uploadfile(blob, lruta).subscribe(
response => {
this.fetcher = response;
this.blockUI.stop();
}, error => {
this.blockUI.stop();
}
);
}
This is my service UploadFile
uploadfile(cabecera, ruta) {
const formData = new FormData();
formData.append('file', cabecera[0]);
formData.append('ruta', ruta);
return this._http.post(this.apiUrl + this.serviceUrl + 'gestion/uploadrevision', formData);
}
When i replace blob with this.file in my this.uploaderService.uploadfile it works, but i dont want to download and upload my file
file: any;
onFileChange(event) {
this.file = event.target.files;
}
解决方案
推荐阅读
- html - 是否建议使用像 .text-center 这样的简单 CSS 类?
- kotlin - Kotlin - 在为 setSpans() 声明开始、结束和标志时,为 SpannableStringBuilder 创建没有重复参数的自定义 ext 函数
- ios - 电话号码 (CordovaCallNumberPlugin) 在 ios 12 上不起作用
- java - 如何通过 JDBC 查询 Oracle 的交集
- python - 使用 Djongo 连接器将 Django 连接到 MongoDB 会引发 SSL 握手异常
- nativescript - 控件属性设置为 false 后,ActivityIndicator 不会关闭
- c# - 使用存储文件夹播放 .mp3 UWP
- https - HTTPS 负载均衡器,用于在 Google Kubernetes 上公开工作负载
- java - NoSuchMethodError:org.apache.poi.ss.usermodel.Font.getIndexAsInt()
- matrix - sympy 矩阵元素圆?