This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Extra Pages and content spilling over to new pages

createsean wrote on 2016-12-30:
I've got pdfcrowd ouputting a pdf fine, however the pdf doesn't format the same as it does when I just output the html and print it. I've got all content wrapped in divs that are 297mm by 210mm (A4 size - landscape) so I would expect that there wouldn't be any overflow to additional pages.

In this pdf created with PDF Crowd you can see how content spills over onto new pages. I also took the exact same content and printed to pdf from the browser and it works correctly as you can see in this pdf.

Is there anything I can do to prevent this overflow?
support wrote on 2017-01-01:
Hello,

If you can send us the HTML code from which the PDF is generated and also your API implementation, we will look into it.
createsean wrote on 2017-01-02:
Hi,

I've attached 2 files, one is the api connection. The other is what is output if I echo the contents rather than send it to pdf crowd. The page where pdf's are created on the staging site is here. Users choose images to include, add copy and titles and then save as a pdf. Currently that page is set to echo pdf rather than send to pdf crowd.
support wrote on 2017-01-04:
Hello,

If I understand your code correctly, the div.page height is 210mm. However, the PDF page height specified in your PHP is 8.5in + margins (2*0.5in) which is 9.5in which equals 241mm. This causes that the div doesn't fit into a single PDF page. To resolve the issue, you need to ensure that the div height is smaller than the PDF page height.
createsean wrote on 2017-01-04:
Thank you, it's working now. Can't believe I missed that.
createsean wrote on 2017-01-06:
I'm still having this issue. I've set my individual page divs to be smaller than a4 size with a page-break-afte:always and on the pdf it's all wonky. However looking at the html everything appears to be correct.

As before I just echo'd the content to see it as html and it looks good, If I go to print using my system printer as landscape a4 everything is correct.However the pdf output is broken.

Have attached the html and pdfcrowd api page (modified since original post). The output pdf is in this drobox link.

Please advise.
createsean wrote on 2017-01-09:
I added this parameter

$client->setPdfScalingFactor(0.5);

Which clearly ensures that the html fits inside the a4 page size but despite that the pages continue to be broken. See attached pdf taken with scaling set to 50%.

please advise.
support wrote on 2017-01-11:
Hello,

I noticed that you use calc(..) function in your CSS. I'm not sure but it is possible that our system doesn't support it. Could you try to remove it and let us know if it helps?