Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » PDF render options
PDF render options [message #815195] Wed, 07 March 2012 10:41 Go to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
Hi we are using the following code to generate pdf

			PDFRenderOption options = new PDFRenderOption();
			options.setOption(PDFRenderOption.PAGE_OVERFLOW, PDFRenderOption.FIT_TO_PAGE_SIZE);
			options.setOption(IPDFRenderOption.FIT_TO_PAGE, true);
			options.setOption(IPDFRenderOption.PAGEBREAK_PAGINATION_ONLY, Boolean.FALSE);
			options.setOption(IPDFRenderOption.PDF_PAGE_LIMIT, new Integer(pageNumber));
			options.setOutputFileName(docName);
			options.setFontDirectory(fontDirectory);
			options.setEmbededFont(true);
			task1 = birtReportEngine.createRenderTask(document);
			task1.setRenderOption(options);
			task1.render();


ideally we would like the pages in PDF should not break. even after setting the PAGE_OVERFLOW property, the pages are breaking where it is unexpected.

Any help is appreciated

Thanks

[Updated on: Wed, 07 March 2012 12:51]

Report message to a moderator

Re: PDF render options [message #815633 is a reply to message #815195] Wed, 07 March 2012 22:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Try:

PDFRenderOption options = new PDFRenderOption();
options.setOutputFileName("output/resample/testpdf.pdf");
options.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
//options.setOption(PDFRenderOption.PAGE_OVERFLOW,
IPDFRenderOption.ENLARGE_PAGE_SIZE);
options.setOption(PDFRenderOption.PAGE_OVERFLOW,
IPDFRenderOption.FIT_TO_PAGE_SIZE);
options.setOption( IRenderOption.HTML_PAGINATION,
Boolean.FALSE );
options.setOutputFormat("pdf");

Set the overflow to enlarge page or fit to page as needed.

Jason

On 3/7/2012 5:42 AM, sam va wrote:
> Hi we are using the following code to generate pdf
>
>
> PDFRenderOption options = new PDFRenderOption();
> options.setOption(PDFRenderOption.PAGE_OVERFLOW,
> PDFRenderOption.FIT_TO_PAGE_SIZE);
> options.setOption(IPDFRenderOption.FIT_TO_PAGE, true);
> options.setOption(IPDFRenderOption.PAGEBREAK_PAGINATION_ONLY,
> Boolean.FALSE);
> options.setOption(IPDFRenderOption.PDF_PAGE_LIMIT, new
> Integer(pageNumber));
> options.setOutputFileName(docName);
> options.setFontDirectory(fontDirectory);
> options.setEmbededFont(true);
> task1 = birtReportEngine.createRenderTask(document);
> task1.setRenderOption(options);
> task1.render();
>
>
> ideally we would like the pages in PDF should not break. even after
> setting the PAGE_OVERFLOW property, the pages are breaking.
>
> Any help is appreciated
>
> Thanks
Re: PDF render options [message #815848 is a reply to message #815633] Thu, 08 March 2012 05:22 Go to previous messageGo to next message
Ganapathy Murugan Rajamanickavasagam is currently offline Ganapathy Murugan RajamanickavasagamFriend
Messages: 3
Registered: March 2012
Junior Member
Jason,
To add more details...
Lets say the Masterpage height is 10 inches and the detail row contents has fields that span multiple lines. When paginated HTML is rendered the page height expands and fits in all the content.

But when we export to PDF the same HTML page splits into 2 pages in PDF as the content cannot fit in the PDF page.

We need the PDF page to not split. Thanks for your help

Ganapathy
Re: PDF render options [message #816288 is a reply to message #815195] Thu, 08 March 2012 16:52 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
Jason

Even after the above code, we still have unwanted page breaks in PDF
We first generate the rptdocument using run task and use render task to generate pdf.

Thanks

[Updated on: Thu, 08 March 2012 19:00]

Report message to a moderator

Re: PDF render options [message #816501 is a reply to message #815848] Thu, 08 March 2012 23:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

The options I posted should do this. Make sure you set this one:

options.setOption( IRenderOption.HTML_PAGINATION,
Boolean.FALSE );

What version are you using?

Jason


On 3/8/2012 12:22 AM, Ganapathy Murugan Rajamanickavasagam wrote:
> Jason,
> To add more details...
> Lets say the Masterpage height is 10 inches and the detail row contents
> has fields that span multiple lines. When paginated HTML is rendered the
> page height expands and fits in all the content.
>
> But when we export to PDF the same HTML page splits into 2 pages in PDF
> as the content cannot fit in the PDF page.
>
> We need the PDF page to not split. Thanks for your help
>
> Ganapathy
Re: PDF render options [message #816502 is a reply to message #816288] Thu, 08 March 2012 23:29 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

What version are you using? Did you use all the options shown?
If your content is a table does changing the page break interval have
any effect.

Jason

On 3/8/2012 11:52 AM, sam va wrote:
> Jason
>
> Even after the above code, we still have unwanted page breaks in PDF
>
> Thanks
Re: PDF render options [message #816692 is a reply to message #816502] Fri, 09 March 2012 06:34 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
we are using 3.7
Also we set the page break interval to 0. Still we see these issues in multiple reports. lets say HTML accomodates 20 records in one page, sometimes in PDF 19 records will come in one page and 1 record will come in the second page. And the rest of the second page is empty. data will start again in third page.

thanks
Re: PDF render options [message #817224 is a reply to message #816692] Fri, 09 March 2012 20:15 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Is the report set to fixed layout? Can you an example report using
sample db?

Jason

On 3/9/2012 1:34 AM, sam va wrote:
> we are using 3.7
> Also we set the page break interval to 0. Still we see these issues in
> multiple reports. lets say HTML accomodates 20 records in one page,
> sometimes in PDF 19 records will come in one page and 1 record will come
> in the second page. And the rest of the second page is empty. data will
> start again in third page.
>
> thanks
Re: PDF render options [message #819601 is a reply to message #817224] Tue, 13 March 2012 05:04 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
Yes this is a fixed layout report
Re: PDF render options [message #820042 is a reply to message #819601] Tue, 13 March 2012 16:48 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you reproduce with the sample db and post the report?

Jason

On 3/13/2012 1:04 AM, sam va wrote:
> Yes this is a fixed layout report
Re: PDF render options [message #821149 is a reply to message #820042] Thu, 15 March 2012 01:34 Go to previous messageGo to next message
Ganapathy Murugan Rajamanickavasagam is currently offline Ganapathy Murugan RajamanickavasagamFriend
Messages: 3
Registered: March 2012
Junior Member
Hi Jason,
This is the code we use to render PDF from the rptdocument. I'll attach a sample report soon....

IReportDocument document = null;
IRenderTask task1 = null;
try {
document = birtReportEngine.openReportDocument(buildDocumentName(workingFolder, jobBo, ReportingConstants.OUTPUT_TYPE_RPTDOCUMENT));
PDFRenderOption options = new PDFRenderOption();
//options.setOption(IPDFRenderOption.PAGE_OVERFLOW, IPDFRenderOption.FIT_TO_PAGE_SIZE);
//options.setOption(IPDFRenderOption.FIT_TO_PAGE, true);
options.setOption(IRenderOption.HTML_PAGINATION, Boolean.FALSE);
options.setOutputFormat(ReportingConstants.OUTPUT_TYPE_PDF);
options.setOutputFileName(buildDocumentName(workingFolder, jobBo, ReportingConstants.OUTPUT_TYPE_PDF));
options.setFontDirectory(birtProperties.getFontDirectory(ceoAppId));
options.setEmbededFont(true);
task1 = birtReportEngine.createRenderTask(document);
task1.setRenderOption(options);
task1.setLogger(reportLogger);
task1.render();
}
Re: PDF render options [message #821196 is a reply to message #821149] Thu, 15 March 2012 03:19 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
Jason

Here is the sample pdf and report. Pl notice that the contents in page 5 should actually be in page 4. this content has overflowed to the next page.

You will notice this ONLY if you do this

View Report in HTML -> Export to PDF
Also notice that, even if you specify "Fit to whole page" this issue is reproducible

If you directly View the report in PDF, this issue doesnt come up

Thanks

[Updated on: Thu, 15 March 2012 03:22]

Report message to a moderator

Re: PDF render options [message #821227 is a reply to message #821196] Thu, 15 March 2012 04:25 Go to previous messageGo to next message
Ganapathy Murugan Rajamanickavasagam is currently offline Ganapathy Murugan RajamanickavasagamFriend
Messages: 3
Registered: March 2012
Junior Member
Our mistake. The above attached report has PageBreakInterval set as 40 and causing the Page Break. Please ignore that report. We will upload another one shortly.
Re: PDF render options [message #821665 is a reply to message #821196] Thu, 15 March 2012 17:04 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Sam,

Run the attached report and see if you get the issue.
I just took the report you posted and set the page break interval to 0
for the table. Without that setting this produces a 117 pg report.
With it set to 0, it produces a 114 pg report.

Jason

On 3/14/2012 11:19 PM, sam va wrote:
> Jason
>
> Here is the sample pdf and report. Pl notice that the contents in page 5 should actually be in page 4. this content has overflowed to the next page.
>
> Thanks
>
  • Attachment: pdftest.zip
    (Size: 3.26KB, Downloaded 271 times)
Re: PDF render options [message #821666 is a reply to message #821665] Thu, 15 March 2012 17:05 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I really need to read all of a thread before responding :>

Jason

On 3/15/2012 1:04 PM, Jason Weathersby wrote:
> Sam,
>
> Run the attached report and see if you get the issue.
> I just took the report you posted and set the page break interval to 0
> for the table. Without that setting this produces a 117 pg report. With
> it set to 0, it produces a 114 pg report.
>
> Jason
>
> On 3/14/2012 11:19 PM, sam va wrote:
>> Jason
>>
>> Here is the sample pdf and report. Pl notice that the contents in page
>> 5 should actually be in page 4. this content has overflowed to the
>> next page.
>>
>> Thanks
>>
>
Re: PDF render options [message #831819 is a reply to message #821666] Thu, 29 March 2012 11:47 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
I worked backward from our report... and was able to successfully reproduce the issue.
Run the report from web viewer. Then export PDF out of the viewer.
Choosing any export options will be the same output. Check the 2nd page. This page has data which has overflown from 1st page.

Jason, its very critical for us. Any help in fixing the issue will be helpful for us.

FYI: One fix would be fixing the detail row height. But we have lot of dynamic text controls with varying data. Fixing the height will truncate the data.

Thanks

[Updated on: Thu, 29 March 2012 11:51]

Report message to a moderator

Re: PDF render options [message #831876 is a reply to message #831819] Thu, 29 March 2012 13:22 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
I believe the problem is with the following piece of code.

<cell id="3017">
                        <method name="onRender"><![CDATA[var myformat = reportContext.getOutputFormat();

if( rowcount > 1 ){
this.getStyle().borderTopWidth = rowBorderWidth;
this.getStyle().borderTopStyle = rowBorderStyle;
this.getStyle().borderTopColor = rowBorderColor;
}]]></method>


if we remove all the instances of the above code, this works fine.

Thanks
Re: PDF render options [message #832380 is a reply to message #831876] Fri, 30 March 2012 04:13 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Where is the variable rowcount set? I thought you were going to
re-upload a report with the issue so I could debug?

Jason

On 3/29/2012 9:22 AM, sam va wrote:
> I believe the problem is with the following piece of code.
>
> <cell id="3017">
> <method name="onRender"><![CDATA[var myformat =
> reportContext.getOutputFormat();
>
> if( rowcount > 1 ){
> this.getStyle().borderTopWidth = rowBorderWidth;
> this.getStyle().borderTopStyle = rowBorderStyle;
> this.getStyle().borderTopColor = rowBorderColor;
> }]]></method>
>
>
> if we remove all the instances of the above code, this works fine.
>
> Thanks
Re: PDF render options [message #832910 is a reply to message #832380] Fri, 30 March 2012 18:49 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
I uploaded the design (Thu, 29 March 2012 07:47)... with that design we are able to reproduce..

but why wouldnt the followin code work

options.setOption(PDFRenderOption.PAGE_OVERFLOW,
IPDFRenderOption.FIT_TO_PAGE_SIZE);
options.setOption( IRenderOption.HTML_PAGINATION,
Boolean.FALSE );

Could you pl tell me why its not fitting into one page

[Updated on: Fri, 30 March 2012 18:53]

Report message to a moderator

Re: PDF render options [message #832944 is a reply to message #832910] Fri, 30 March 2012 19:25 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I believe the page break interval will override that setting.

Jason

On 3/30/2012 2:49 PM, sam va wrote:
> I uploaded the design... with that desiggn we are able to reproduce..
>
> but why wouldnt the followin code work
>
> options.setOption(PDFRenderOption.PAGE_OVERFLOW,
> IPDFRenderOption.FIT_TO_PAGE_SIZE);
> options.setOption( IRenderOption.HTML_PAGINATION,
> Boolean.FALSE );
>
> ITs not fitting into one page
Re: PDF render options [message #1767439 is a reply to message #832944] Thu, 06 July 2017 06:11 Go to previous messageGo to next message
Priya M is currently offline Priya MFriend
Messages: 2
Registered: June 2017
Junior Member
Hi. I am working on a BIRT report with one of the cell is a dynamic text element. I have set the 'Overflow property - Auto' in Advanced tab of the cell properties, since the last few parts in the cell are invisible in the report.
Scroll bar appears for the element, if the data inside the text element is too long and the entire content is visible using the scroll. This works fine in BIRT Report viewer. However I am facing problem in exporting the report into PDF format wherein the last few parts are truncated.
I am using the eclipse BIRT version 4.5.0
Kindly help me in this issue
Thanks

[Updated on: Thu, 06 July 2017 06:12]

Report message to a moderator

Re: PDF render options [message #1831770 is a reply to message #1767439] Fri, 28 August 2020 13:50 Go to previous message
Mir Rafiquddeen is currently offline Mir RafiquddeenFriend
Messages: 2
Registered: August 2020
Junior Member
Hi Priya,

You can click on the Master Page tab, and in its properties, change the property 'Type' to 'Custom' from 'US Letter' which will be the default Type. This will enable you to adjust the Width of the page and hence render a proper output in PDF
Previous Topic:Eclipse Birt - How to group dimensions in data cube
Next Topic:Eclipse Birt - Remove default sorting of dimensions in data cube
Goto Forum:
  


Current Time: Sat Sep 18 08:48:54 GMT 2021

Powered by FUDForum. Page generated in 0.04252 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top