0

The image I'm creating with dimension 1140x3190 is not converting properly into pdf using pdfmake. Only first part with one page pdf is generating.

Here is my code ::

<script defer src="/js/library/html2canvas.js"></script>
<script defer src="/js/library/pdfmake.min.js"></script>
<script defer src="/js/library/vfs_fonts.js"></script>

html2canvas(document.getElementById('content_area'), { 
    onrendered: function (canvas) {
        var data = canvas.toDataURL(); 

        width = canvas.width; //1140
        height = canvas.height; //3190

        var docDefinition = {                          
            content: [{
                image: data,
                width: width,
                height: height 
            }]
        };                     
        pdfMake.createPdf(docDefinition).download("sample.pdf");
    }                    
});

Any help will appreciate.

onetwo12
  • 2,359
  • 5
  • 23
  • 34
Moumita
  • 360
  • 8
  • 26
  • Are you creating the image? Please post a screenshot of what is happening. – Aakash Verma Jul 21 '17 at 11:22
  • I'm creating an image of a html content with id #content_area. The generated image was same as the html content. but when its converting into pdf, its generate only one page .. rest of the image was missing.. The pdfmake not able to convert whole image into pdf file. – Moumita Jul 21 '17 at 11:33
  • Possible duplicate of [How to set image to fit width of the page using jspdf?](https://stackoverflow.com/questions/36472094/how-to-set-image-to-fit-width-of-the-page-using-jspdf) – Aakash Verma Jul 21 '17 at 11:33
  • @Moumita having same problem here, did you get it work? – Nikhil Radadiya Aug 23 '17 at 13:39
  • @Moumita you need to create images of elements and push into `content` and then pass it to `docDefination` – Nikhil Radadiya Aug 29 '17 at 08:22
  • Has the issue resolved...?? – Akshay Soam Sep 11 '17 at 06:36

0 Answers0