Cara membuat fail pdf berdasarkan saiz kelas (html2pdf)
P粉060112396
P粉060112396 2024-03-30 19:17:06
0
1
495

我使用html,javascript和lib html2pdf

Cara membuat fail pdf berdasarkan saiz kelas (html2pdf)

function generatePDF(){
var element = document.getElementById('purchase-paper');
var opt = {
    margin: 1,
    filename: 'test.pdf',
    image: {type:'jpeg',quality:0.98},
    jsPDF: {unit:'in',format:'letter',orientation:'portrait'}
};
html2pdf().set(opt).from(element).save();
console.log("Test")};

Saya hanya mahu mengeksport pdf 1 halaman.

P粉060112396
P粉060112396

membalas semua(1)
P粉403549616

Cuba ini:

function generatePDF(){
      
    var element = document.getElementById('purchase-paper');
    var opt = {
        margin: 1,
        filename: 'test.pdf',
        image: {type:'jpeg',quality:0.98},
        jsPDF: {unit:'in',format:'letter',orientation:'portrait'},
        pageBreakBefore: function(currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
            if (currentNode.id === 'purchase-paper') {
                return true;
            }
            return false;
        }
    };
    html2pdf().set(opt).from(element).save();

}
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan