+ Start a Discussion

Render PDF and Page Breaks

I am trying to render a PDF using the <div style="page-break-after:always;"> </div> to createpage breaks across a set or repeating table tags. Is there anything I can do do avoid this happening?


PDF generation encountered problems with the layout of your page and couldn't complete because the request took too long. Possible reasons include blocking normal page breaks from rendering.


Where is your div tag?  Is it inside of your table or outside?  This particular page-break style is a little finicky and it's hard to tell when it's going to cause the PDF engine to churn.  If you forget the div and put it on the table tag itself does it work?  Or the <tr>, whatever the case may be.  I'm not sure when you're trying to page break on.


Unfortunately there's no silver bullet when it comes to this stuff, just a lot of trial and error and I'm not very familiar with these CSS styles so I'm not sure how much help I'll be.  The last time we tried to troubleshoot an issue on this the problem was with putting a div inside of a table tag (not proper HTML, and it did not play nice with PDF generation).


In general you have to be careful trying to confine things to a page when it's possible that your content could grow too large to fit inside of a page.


Hi Jill


thanks for the response. I was using the technique outlined in this article to create table headers on each page and it works fine...but maybe there is a more efficient method to achieve the same effect?


Actually, I just tried the page again a little while ago, and it worked fine, and in fact the full pdf was rendered pretty quickly - so I am wondering if there were just some performance issues on tapp01/na3 today that had an impact? 

I am not very much clear about your requirement. I found a 100% native pdf generation tool in appexchange and I think it can be the most wonderful PDF generation tool currently in appexchange. They say that the product is 100% native. I am suing a 30 day trial of it. They supply the pdf customization facility. I got some Ideas about page-breakings by looking at their sample visualforce template pages. 
You can see some pdf samples here. 

Hi...Just try to reduce the amount of data which is being populated into the PDF...This is a Salesforce generated message which lets you know that the pDF generation Engine which is working in the back-ground, is taking too long to response, because of the data which is being populated into the PDF...