簡體   English   中英

如何在使用 jspdf-autotable 創建的 pdf 中的表格之前插入文本

[英]How to insert a text before the table in a pdf created with jspdf-autotable

原諒我的英文表達。 我無法在使用 jspdf autotable 制作的表格前插入文本,我正在處理 Angular 8 項目。

我不明白為什么它不起作用。 該表似乎是 static。

var conf={

    margin: {
      right: 5,
      left:5,
      bottom:5,
      top:5
    }
  }
import * as jsPDF from 'jspdf'; 
import 'jspdf-autotable';

printPDF(){
  let columns = ["Ref", "Art",'Qte',"Remise","Prix TT"];
  let rows = [
      [1523, "TT", 785,'555',"555,555"],
      [1523, "TT", 785,'555',"555,555"],
      [1523, "TT", 785,'555',"555,555"],

  ];
 let doc = new jsPDF('p', 'mm',[1000,400],1);

doc.text(50,10,'my text');
  doc.autoTable(columns, rows,conf, ); 
  doc.save('table.pdf');

我想我已經找到了解決方案,您只需要選擇邊距值:頂部

如:var conf={

    margin: {
      ........
      top:50
    }

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM