【问题标题】:How to save pdf file to a folder in front end itself如何将pdf文件保存到前端本身的文件夹中
【发布时间】:2023-01-26 01:29:45
【问题描述】:

我需要使用 jspdf 将生成的 pdf 文件保存到前端本身的特定文件夹中

     let pdf = new jsPDF('p','pt',[500,500]);
     pdf.html(this.Pdfdiv.nativeElement, {
     callback: (pdf) => {
      pdf.output('assets/test.pdf');
      pdf.save('test.pdf');

这对我不起作用,因为我在这里遇到错误:

No overload matches this call.
The last overload gave the following error.
Argument of type '"assets/test.pdf"' is not assignable to parameter 
of type '"dataurl" | "datauri"'.ts(2769)
index.d.ts(844, 5): The last overload is declared here.

【问题讨论】:

  • 那么,您面临的问题是什么。请解释您的问题,以便我们更好地帮助您。
  • @AniruddhThakor 好的,我已经用我遇到的错误更新了问题..

标签: angular pdf-generation jspdf


【解决方案1】:

Primero captura el blob luego o ingresas al FormData y después lo envías al 服务。

var blob = doc.output("blob");

window.open(doc.output('bloburl'),"_blank","top=100,left=200,width=1000, 高度=500");

var 参数 = { 档案:斑点, 名称:“PRUEBA”+“-”+“sdsd.pdf” };

body.append('myfile', element.archivo, element.nombre);

y luego mandas el formData al server y lito。

【讨论】:

    猜你喜欢
    • 2019-05-15
    • 1970-01-01
    • 1970-01-01
    • 2014-03-04
    • 1970-01-01
    • 2016-12-15
    • 1970-01-01
    • 2013-05-15
    • 2021-08-28
    相关资源
    最近更新 更多