Dynamic page adding through jsPdf

Posted by Vishakh Shetty on Stack Overflow See other posts from Stack Overflow or by Vishakh Shetty
Published on 2013-10-11T11:53:07Z Indexed on 2013/11/02 21:54 UTC
Read the original article Hit count: 1460

Filed under:
|

I am trying to convert content from tinymce editor to pdf using Jspdf.

But as JSpdf creating single pdf page only initial 30 lines from editors appering in PDF.. So how can I add page dynamically to convert whole content to pdf??

My CODE:

function save_to_pdf() {
  var myIFrame = document.getElementById(text_ifr);
  var content = myIFrame.contentWindow.document.body.innerHTML;
  $('#pdf_text').html(content);
  var pdf = new jsPDF('p', ' in ', 'letter'),
    source = $('#pdf_text')[0],
    specialElementHandlers = {
      '#bypassme': function(element, renderer) {
        return true;
      }
    };
  pdf.fromHTML(
    source, // HTML string or DOM elem ref.
    0.5, // x coord
    0.5, // y coord
    {
      width: 7.5, // max width of content on PDF
      elementHandlers: specialElementHandlers
    }
  );
  pdf.addImage(imageData, JPEG, 95, 5, 20, 20);
  pdf.save(Test.pdf);
}

Thanks in Advance

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jspdf