Generated PDF page limitation
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
Hi there,
If you could post some example code, I may be able to suggest something.
Thanks, James
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
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
+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?
I'm also looking for a solution to this.
No one for a solution!!!!! badly need a solution ....
See #46
Thanks!
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
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
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
same issue here, on a greasemonkey script using jsPDF
@foo123, @umeshd - perhaps you've used an older version of jsPDF (i did until i realized cdnjs is not updated with jsPDF latest version)

here's a plunker with the latest version (valid for 2014-12-11) working: http://plnkr.co/edit/5NonsdQ23nXwFchV01sB?p=preview
thanks, @Jossef , wil try that even though i had downloaded latest version from github (to make sure)
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
- JsPDF supports JqGrid styles
- 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
)
Did anyone get the "pagesplit" thing working?
@jossef: It seems to work only in plunker. When I try to copy the same code and reproduce it, it just bombs... :(
I had to use the version of jspdf in the plunker example to get it to work.
Anyone able to add page numbers using jspdf?