Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Charts cut off in PDF
cypherdj
Hi,<br />
<br />
I'm currently implementing a server side print functionality as part of my web application. I'm using the DE API and have implemented my own viewer (HTML produced displayed in an iframe).<br />
<br />
I've now added functionality to print the report on the server side. In this case, the stored rptdocument is rendered in PDF format, and then sent to the printer using the Java Print Service.<br />
<br />
To create the PDFRenderOption, I use the following code:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
PDFRenderOption option = new PDFRenderOption();
option.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
option.setSupportedImageFormats("PNG");
filename = "/report" + getTimeStamp() + ".pdf";
option.setOutputFileName(context.getRealPath(REPORT_HOME + filename));
</pre>
<br />
(Note the HTML rendering using SVG for images, but this is not supported in PDF AFAIK)<br />
<br />
When I open up the generated PDF document, my table is produced as expected, the charts are appearing but are being cut off (see attached zip file, charts on page 2).<br />
<br />
In the report design, I specifically set the size of the charts to 4.5x3.5 inches.<br />
<br />
Any idea what could cause this?<br />
<br />
Kind regards,<br />
Cedric
Find more posts tagged with
Comments
mwilliams
Hi Cedric,
In your report design, how are the charts situated? In a grid? Just placed in the report? Also, are you using the fixed layout option?
cypherdj
In the report, I have a 2x1 grid. In the 1st row of that grid, I display a crosstab, while in the 2nd row of the grid, I have another 1x2 grid to hold the 2 charts. Maybe I should have just a 2x2 grid and merge the cells in the 1st row to accomodate my crosstab ;-)
For the layout option, I'm using the default "auto layout". Should I be using fixed layout?
Thanks,
Cedric
mwilliams
Cedric,
You might try also setting the height and width of the actual grid cells that the charts are in as well as the charts(which you've already done). There may be something goofy going on there. If that doesn't work, try the fixed layout.
cypherdj
Michael,
I've just tried to use Fixed Layout in my report design properties and the report appears in my viewer as the PDF does.
I'll look into whether I can specify the layout option in the PDFRenderOption to Auto Layout, and that should hopefully fix my problem.
Thanks,
Cedric
cypherdj
Ok, I tried adding the following to the PDFRenderOption:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
option.setOption(DesignChoiceConstants.CHOICE_REPORT_LAYOUT_PREFERENCE, DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_AUTO_LAYOUT);
</pre>
<br />
Unfortunately, that did not have any effect on the actual layout of the produced PDF.<br />
<br />
Am I doing this wrong or does that mean I need to use fixed layout in the report design (in which case I'll need to fix the HTML layout as well, which I'd rather avoid if I can)?<br />
<br />
Thanks,<br />
Cedric
mwilliams
Cedric,
Here's a few things that you could try. Not sure that any will help, but could be worth a shot. You could try deleting the grid that the charts are in and redo it. There could be some setting on them that's causing a glitch. You could also try putting both charts into a 1 cell grid that stretches across the page. You could even try to take the dimensions off of the charts and see if the PDF output autosizes them to fit on the page. Just trying to think of something that will keep you from having to redo anything with your viewer.
cypherdj
Thanks, I'll give it a shot.
cypherdj
Hi,
I've just tried removing the width and height properties of the charts, and the HTML rendering is not ideal in this case. Furthermore, though printing to PDF does not generate any errors and the file is successfully added to the print queue, the document is never actually printed.
Also, in the master page properties, the settings are:
- name: Simple Master Page,
- orientation: auto,
- shrink: false,
- type: us-letter,
- width: 8.5in
- right/left margin: 1.25in
As each chart had a width of 3.5in, with potentially 3 charts displayed side by side, I guess this would never fit in a 8.5in page for this specific report. So I created a 3rowsx1col grid to display the charts below each other, and the charts printed correctly after that.
I'll just have to keep that in mind when designing reports,
Cheers,
Cedric
mwilliams
Good, I'm glad there was a way around you having to change your custom viewer.
cypherdj
So am I ;-)