jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

Generated PDF page limitation

Open mzubairahmed opened this issue 13 years ago • 27 comments

I am using this API and found it real faster PDF Converter. But i am facing an issue with this API that it does not intend or add pages itself if my text size is increased to one page. Is there any work around apart from adding the new page myself while in the loop? please suggest.

Thanks

mzubairahmed avatar Mar 19 '13 09:03 mzubairahmed

Hi there,

If you could post some example code, I may be able to suggest something.

Thanks, James

MrRio avatar Mar 21 '13 09:03 MrRio

Hi! I don't know if @mzubairahmed was trying to make a PDF from HTML but this happens in the demo HTML Renderer example.

Trying with the other examples and its the same, for example drawing a recatngle bigger than the page.

Cheers, Andrés

aemb87 avatar Apr 03 '13 18:04 aemb87

Dears, sorry for posting a bit late. What i was trying to ask is very easy. you can also generate the code. Just create an HTML page and use the jsPDF script to convert that html page into PDF. it will convert it perfectly but try to provide a large html data that exceeds the PDF page. you will see the issue yoursefl. the jsPDF utility won't add the next pages for you. it will continue writing the text on the same PDF page and you'll find the text at the bottom of the single generated PDF page cutting out and then nothing displayed.

Thanks

mzubairahmed avatar Apr 04 '13 07:04 mzubairahmed

+1 for this issue!

I found this lib very usefull. An ellegant solution for generating pdf on-demand (saves lots of clocks of my servers :)

It would be really nice if fromHTML() could split across multiple pages automatically or by inserting specific tags/attribs into the DOM myself. For example, for a long table, one <tr> could have a hint like <tr jspdf=split>.

Does anyone have a workaround for this?

caruccio avatar Jun 19 '13 14:06 caruccio

I'm also looking for a solution to this.

joshleblanc avatar Oct 11 '13 13:10 joshleblanc

No one for a solution!!!!! badly need a solution ....

hiracse091 avatar Nov 27 '13 06:11 hiracse091

See #46

diegocr avatar Feb 08 '14 06:02 diegocr

Thanks!

mzubairahmed avatar Feb 11 '14 13:02 mzubairahmed

jspdf rendering a blank pdf if it has got more pages in it, ex:for 35+ pages its rendering blank pdf.. how to overcome this issue

AnithaN avatar Oct 08 '14 05:10 AnithaN

doc.fromHTML($('#divReport').get(0), 15, 15, { 'width': 250, 'margin': 1, 'pagesplit': true, //This will work for multiple pages 'elementHandlers': specialElementHandlers });

pageSplit option will work for Splitting PDF into multiple pages

azamSE avatar Oct 14 '14 06:10 azamSE

I am using 'pagesplit':true, as shown in below code but page split is not happening.

var doc = new jsPDF();

    var elementHandler = {
      '#render_me': function (element, renderer) {
           return true;
      }
    };
    doc.fromHTML($('#render_me').get(0), 15, 15, {
        'width': 170, 
        'margin': 1,
        'pagesplit': true,
        'elementHandlers': elementHandler
    });
    doc.save('Test.pdf');

I am using jsPDF-0.9.0rc2/jspdf.plugin.from_html.js

umeshd avatar Oct 17 '14 02:10 umeshd

same issue here, on a greasemonkey script using jsPDF

foo123 avatar Nov 06 '14 16:11 foo123

@foo123, @umeshd - perhaps you've used an older version of jsPDF (i did until i realized cdnjs is not updated with jsPDF latest version)

image

here's a plunker with the latest version (valid for 2014-12-11) working: http://plnkr.co/edit/5NonsdQ23nXwFchV01sB?p=preview

jossef avatar Dec 11 '14 07:12 jossef

thanks, @Jossef , wil try that even though i had downloaded latest version from github (to make sure)

foo123 avatar Dec 11 '14 12:12 foo123

Hi,

I am using JsPDF for generating webpage div content to PDF. I am able to generate pdf. it is not giving proper lay out design of the grid. I have 7 JqGrids in my web page. My question are

  1. JsPDF supports JqGrid styles
  2. How to apply specific styles

please help me regarding this issue. please find the below code.

                    var pdf = new jsPDF('l', 'pt', 'a4')

                          // source can be HTML-formatted string, or a reference
                          // to an actual DOM element from which the text will be scraped.
                                    , source = $('#divid')[0]
                          // we support special element handlers. Register them with jQuery-style
                          // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
                          // There is no support for any other type of selectors
                          // (class, of compound) at this time.
                          , specialElementHandlers = {
                              // element with id of "bypass" - jQuery style selector
                              '#CreateTransSAccView': function (element, renderer) {
                                  // true = "handled elsewhere, bypass text extraction"
                                  return true
                              }
                          }

                    margins = {
                        top: 80,
                        bottom: 60,
                        left: 40,
                        width:750
                    };
                    // all coords and widths are in jsPDF instance's declared units
                    // 'inches' in this case
                    pdf.fromHTML(
                        source // HTML string or DOM elem ref.
                        , margins.left // x coord
                        , margins.top // y coord
                        , {
                            'width': margins.width // max width of content on PDF
                            , 'elementHandlers': specialElementHandlers
                        },
                        function (dispose) {
                            // dispose: object with X, Y of the last line add to the PDF
                            //          this allow the insertion of new lines after html                             
                            pdf.save('Receipt of Confirmation Single Account.pdf');
                        },
                        margins
                      )

ghost avatar Feb 24 '15 09:02 ghost

Did anyone get the "pagesplit" thing working?

pradeepkchandra avatar Dec 08 '15 21:12 pradeepkchandra

@jossef: It seems to work only in plunker. When I try to copy the same code and reproduce it, it just bombs... :(

pradeepkchandra avatar Dec 08 '15 22:12 pradeepkchandra

I had to use the version of jspdf in the plunker example to get it to work.

pomegrn8 avatar Oct 22 '16 20:10 pomegrn8

THEMBOCHARLES avatar Mar 14 '17 12:03 THEMBOCHARLES

Anyone able to add page numbers using jspdf?

valimpact avatar Apr 19 '17 18:04 valimpact