Home
Analytics
Page breaks with Dynamic Text, leaves page empty
mahvish
Page breaks not working correctly with dynamic text [html content]. I have html content inside a table column, if next rows contents are lengthy then whole row is shifted to next page [leaving first page half blank], instead of breaking html content into pages. I have BIRT 3.7 and tried setting row page-break-inside to auto and dynamicText page-break-inside to auto.
Any help would be really appreciated.
Find more posts tagged with
Comments
mwilliams
This only happens when the content of the text box is HTML? Let me know. I'll check it out. I know this had been an issue in earlier versions, but I thought it had been fixed.
mahvish
Thanks for your quick response!
Yes, this happens when the contents are HTML and Fixed layout. When I set layout to AUTO then birt viewer has no pagination, PDF is near to the desired output.
But line-spacing or line-height is higher in PDF for HTML content. Also, word or Excel is not giving me the desired result; again for HTML content.
mwilliams
What if you used auto layout and then only add a page break interval to your table if viewing in HTML format? If so, you'd simply put something like this in your beforeFactory script area:
if (reportContext.getOutputFormat() == "html"){
reportContext.getDesignHandle().findElement("myTable").setPageBreakInterval(20);
}
Make sure you name your table "myTable" in the property editor for your table.
This would make a fixed number of rows per page in HTML output, but allow your PDF to roll through page breaks naturally. I don't know what the spacing issues you're having are. Can you give me some sample html that will show me the spacing issues?
mahvish
I have noticed that html content having <p> tags increases the line spacing in PDF format..
Is there a way through which we can change PDF generation process?
mwilliams
You might check the bugs at eclipse.org/birt and see if it's been reported. If not, please do so. This has been an issue for a while, it seems. PDF seems to add a line for each <p> or </p>. If you simply put:
paragraph1
<p>
paragraph2
The look seems to be more consistent across all formats, though, this is obviously not an ideal workaround. If you find the bug for this or post a new one, please post the bug info in here for future reference. Thanks!
actuser9
<p>Hi Michael,</p>
<p> </p>
<p>Any idea if this issue is resolved in iHub3 Fix1 or if there is a possible workaround to eliminate the issue happening with the HTML text element in combination with Fixed Layout.</p>
<p> </p>
<p>Appreciate any guidance on this!</p>
<p> </p>
<p>Thanks,</p>
<p>UY</p>
mwilliams
<p>Hey UY,</p>
<p> </p>
<p>I'll take a look into this in the morning to see if there has been any change with iHub3.1</p>
<p> </p>
<p>A possible workaround could be to write a bit of script on your text elements removing the </p> when the output format is PDF.</p>
actuser9
<p>Tried that option to remove '<p/>' but still does not work! We have a data item as header followed by the dynamic text element. If we take out the data item element, then the page break does not happen.</p>
<p> </p>
<p>Any updates?</p>
mwilliams
<p>Can you attach a simple example I can run that shows your setup. I'll test it in the next release and in the current release to see if I can find a way around it until that is released.</p>
actuser9
<p>Hi Michael,</p>
<p> </p>
<p>Attached the sample report. </p>
<p> </p>
<p>
mwilliams
<p style="font-size:14.4444446563721px;">Hey UY,</p>
<p style="font-size:14.4444446563721px;"> </p>
<p style="font-size:14.4444446563721px;">It looks like there is some sizing differences between PDF and HTML. I would guess this would be an iText (library used to create PDF emitter) thing, but I don't know that for sure. If you set the header sizes to 1 and the text control default size to 7, it seems to work out properly in the PDF file, but then is very small in the HTML output. You might contact support on this or file a bug for open source on the eclipse.org/birt community section as it seems to be an issue there as well, though, again, I'm not sure if this issue is actually on BIRT's end.</p>
actuser9
<p>Hi Michael,</p>
<p> </p>
<p>Thank you and sorry for replying late on this. I had create support case with Actuate but not much luck with the solution yet. Thinking through various solutions one of it being the suggestion you had on earlier posts with getting rows that can be accomodated in the fixed page. Still wondering though!</p>
mwilliams
<p>If you're not able to find a workable solution, let me know and I can help find a workaround.
</p>
actuser9
<p>Hi Michael,</p>
<p> </p>
<p>What other workaround that you can think of for this scenario? please let me know..
</p>
mwilliams
Hey UY,<br><br>A script like this in your text element's onRender script would get you a workable PDF output that's much more similar to the HTML output:<br><br><pre class="_prettyXprint _lang-auto _linenums:0">
if(reportContext.getRenderOption().outputFormat == "pdf"){
this.getStyle().fontSize = "7";
this.text = this.text.replaceAll("<font color=\"#0000ff\" size=\"2\">","<p style='margin:5px 5px 0px 0px; color:#0000ff; font-size:120%;'>");
this.text = this.text.replaceAll("<p>","<p style='margin:5px 5px 0px 0px;'>");
this.text = this.text.replaceAll("</font>","");
}
</pre>Not sure if it'll do exactly what you're wanting, but it might give you a starting point for working the PDF output to look how you'd like.
Slavi
<blockquote class="ipsBlockquote" data-author="mwilliams" data-cid="134132" data-time="1425336562">
<div>
<p>Hey UY,<br><br>
A script like this in your text element's onRender script would get you a workable PDF output that's much more similar to the HTML output:<br>
</p>
<pre class="_prettyXprint _lang-auto _linenums:0">
if(reportContext.getRenderOption().outputFormat == "pdf"){
this.getStyle().fontSize = "7";
this.text = this.text.replaceAll("<font color=\"#0000ff\" size=\"2\">","<p style='margin:5px 5px 0px 0px; color:#0000ff; font-size:120%;'>");
this.text = this.text.replaceAll("<p>","<p style='margin:5px 5px 0px 0px;'>");
this.text = this.text.replaceAll("</font>","");
}
</pre>
Not sure if it'll do exactly what you're wanting, but it might give you a starting point for working the PDF output to look how you'd like.
<p> </p>
</div>
</blockquote>
<p>This works a treat! Thank you.</p>