0

I am creating a pdf from the html document with the help of the jspdf plugin. It is generating the pdf but the font looks blurred and pixelated. Can you please suggest me how to increase the quality of the pdf and the font in the pdf? Here is my jspdf code below:

function GeneratePDF() {
    var pdf = new jsPDF("p", "pt", "a4");
    var pdfName = 'Reports.pdf';

    var options = {};

    document.getElementById('page-loader').style.display='block'; 

    var $divs = $('.target');
    var numRecursionsNeeded = $divs.length - 1;
    var currentRecursion = 0;


    function recursiveAddHtmlAndSave(currentRecursion, totalRecursions) {
        if (currentRecursion == totalRecursions) {
            document.getElementById('page-loader').style.display='none'; 
            pdf.save(pdfName);
        } else {
            currentRecursion++;
            pdf.addPage();
            pdf.addHTML($('.target')[currentRecursion], 6, 7, options, function () {
                // console.log(currentRecursion);
                recursiveAddHtmlAndSave(currentRecursion, totalRecursions)
            });
        }
    }

    pdf.addHTML($('.target')[currentRecursion], 6, 7, options, function () {
        recursiveAddHtmlAndSave(currentRecursion, numRecursionsNeeded);
    });

}
ProgrammerPer
  • 1,125
  • 1
  • 11
  • 26
vamsi krishna
  • 33
  • 1
  • 6
  • what do you mean with *"increase the quality of my pdf font and images"* that question is too wide. Please be more specific. If you have an error, or you want to fix a particular bug, or why do u think the quality is not good enough for you and what is what u r expecting will provide more information to us. – Teocci Feb 01 '19 at 09:02
  • If the answer is working in your case just let others know by right the answer https://stackoverflow.com/questions/54475959/how-to-increase-the-quality-of-my-pdf-font-and-images-using-jspdf/54476110#54476110 – Googlian Feb 01 '19 at 09:06
  • Possible duplicate of [Why html2canvas produced blurry pdf file?](https://stackoverflow.com/questions/53887113/why-html2canvas-produced-blurry-pdf-file) – Weihui Guo Feb 03 '19 at 03:57

0 Answers0