简体   繁体   中英

JSPDF: Weird PDF Format

I am using jsPDF to convert html into PDF file.

This is what it looks like from the browser:

在此处输入图像描述

This is the PDF file:

在此处输入图像描述

Here is my code:

const doc = new jsPDF();
doc.html(document.getElementById('print-content')!, {
  callback: function (doc) {
    doc.save(activeSales?.ID + '.pdf');
  },
});

How to make it responsive when generating the pdf?

I want to generate it in A4 width.

i know this is too late, but I faced the same issue before.

You can use another library called jsPDF-AutoTable which will make it easier for you to work with tables.

Here's the doc: https://github.com/simonbengtsson/jsPDF-AutoTable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM