HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › Issue with Blank pages
- This topic has 13 replies, 2 voices, and was last updated Oct 16, 2015
03:00:29 byPD4ML.
-
AuthorPosts
-
October 6, 2015 at 13:10#26898
Hi,
Could you please tell us is there any way to avoid the blank pages in between in PD4ML. When we generate a PDF, we were getting blank pages in between with just header and footer and no text content in this. we are using div & tables which are having margin bottom also. But is there any way in PD4ML where we can remove the pages with blank text
Regards
SarinOctober 6, 2015 at 13:18#29470PD4ML automatically removes blank trailing pages only. In your case it would make sense to determine the problem reason.
First try to temporarily define DIV and TABLE borders to see if invisible parts of them (content padding etc) are wrapped to next pages.
DIV, TABLE { border: 1 solid tomato }October 7, 2015 at 04:04#29465Yes, a very very small part of the div(say, 2px) which is caused by margin bottom comes to the next page. Please let us know how we can avoid it, thanks in advance
October 7, 2015 at 14:13#29466Try to increase htmlWidth conversion parameters in small amounts, until a page content fits a page space.
October 7, 2015 at 16:01#29467But in our case, the contents are dynamic, so we can’t do it for one page, whether any solutions to avoid this
October 7, 2015 at 16:22#29468In your case a possible reason of an appearance of a blank page, is a page content exceeds given page height and followed by a page break directive (most probably “page-break-before: always” CSS property; possibly
<pd4ml:page.break>tag).So alternatively you may suppress/override page-break-before style (with pd4ml.addStyle() API call, for example)
But if the issue is the same with a variety of your documents (page content does not fit only few pixels), obviously the page layout has been developed for a smaller content scale. You can scale down the content by an increasing of htmlWidth parameter.
October 8, 2015 at 11:10#29469Thank you for your help
Could you please tell us whether it it possible to know the remaining space available in page
In page break, we are using ifSpaceBelowlessThan condition.
Likewise, whether there is any option whether we can write a div/span in JSP/FTL based on the available space in pdf
October 9, 2015 at 11:05#29464Or whether can you please tell us whether it is possible to find out the page height , page header height, page footer height in jsp/ftl
we are using inline header/footer. So whether it is possible to find out the heights using PD4ML
thank you
October 9, 2015 at 12:47#29462Page width and height (paper format) is given as a conversion parameter. By default it is A4.
HTML is rendered using htmlWidth parameter (an equivalent of web browser frame width).
By a conversion, htmlWidth is mapped to given paper width (minus horizontal margins).
A height of page (from HTML perspective) can be computed from the above info.
See https://pd4ml.com/cookbook/pdf_page_formatting.htm for more details.
But I would think you are trying to go a wrong way. Probably it would make more sense to enclose logical parts of document to
<div style="bage-break-inside: avoid"> ... </div>sections and let PD4ML break the content to pages.October 10, 2015 at 05:54#29463
thank you for your reply
But in our case, we have a table in which we have article details. there is margin of 5 px from top & bottom. we have already given a page break inside as avoid.
In one scenario, the article length is more and it split into two pages. In that scneario, the text comes to the very last line above the footer. As we have a margin & padding, the padding only comes to the next page. As there is no content, everyone seems it as blank. If we removed the margin & span, then there is no blank page. But in our case, we can’t remove the margin as the other sections/styles are depend on this. Also, we cant reduce the htmlwidth as the prototyope is already aligned. is there any solution without changing the htmlwidth. Could you please tell us the best way to solve this
thank you
October 10, 2015 at 05:56October 15, 2015 at 07:33#29458Could you please share if you have any more thoughts on this, added the image to identify the exact issue, thank you
October 15, 2015 at 17:01#29459We’ll try to experimentally exclude a bottom margin (as well as a bottom padding if an element border is not defined) from element height calculations in the page break logic. In theory it should solve the issue you are faced with.
The feature will take 2-3 days to implement/test.
October 16, 2015 at 03:00#29460Ok thank you, will wait for your solution
-
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.
