Home
Analytics
Image quality - report - pdf
jamesniles
Is there a way to control the image quality when it goes to PDF?
I've got a report which has 2 dynamic image links and everything looks good when previewing on the viewer. However, when I export to pdf the quality of the image is pretty iffy at best (very grainy and blury). I saw where there is a dpi default of 96 and when I changed it, my actual image in the report decrease in size (which I'm sure I wasn't doing something correct....)
The image files are .png format
I appreciate any and all help
Find more posts tagged with
Comments
kclark
You should be able to change the DPI<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
PDFRenderOption options = new PDFRenderOption();
options.setOption(IPDFRenderOption.PDF_HYPHENATION, true);
options.setOption(IPDFRenderOption.PDF_TEXT_WRAPPING, true);
options.setOption(IPDFRenderOption.PAGE_OVERFLOW,
IPDFRenderOption.FIT_TO_PAGE_SIZE);
options.setOption(IPDFRenderOption.DPI, 300);
options.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
options.setOutputFileName("output/resample/test.pdf");
options.setOutputFormat("pdf");
</pre>
jamesniles
Thanks - exactly where can that be controlled? Is it a script or a config file (somewhat new to Birt)
jamesniles
I get an error message (below). This is not a chart but 2 images (with a png extension)
++++++++++++
ReportDesign (id = 1):
+ There are errors evaluating script "reportContext.getRenderOption().CHART_DPI = "300";":
TypeError: Cannot set property "CHART_DPI" of null to "300" (/report/method[
@name="
;initialize"]#1)
+++++++++++++
kclark
What version of BIRT are you running?<br />
<br />
You could use <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.org.eclipse.birt.report.engine.api);
reportContext.getAppContext().put( EngineConstants.APPCONTEXT_CHART_RESOLUTION, 1000 );
</pre>
<br />
In your initialize() it makes a difference in earlier version of BIRT, the newer ones allow you to zoom in further.
jamesniles
I'm using
Viewer Version: 2.6.2
Engine Version: 2.6.2
JRE Version: 1.7.0_07-b11
Tomcat Version: 7.0.32
Eclipse BIRT Designer Version 3.7.0.v20110602 Build
.7.0.v20110607-1526>
kclark
Did you try the above code?
jamesniles
Did not work.
The process I'm going through is the following:
1. Create an image using Snagit and save as a png file
2 Dynamically linking images into report (2 column report - one column is 8.1 wide and the other column is 2.1 - page size is 8.5x11 - landscape format)
3. In column 1, I've scaled the image to fit the column (765 pixals) because the image is too large.
In column 2, no scaling
4. I then use the [Run]/[View Report] / [In Web View] and the image looks crisp. I then click on the Print option and print to pdf and then the image is reduce and blurry.
Previously (before Birt), I created this report in Microsoft Access using the same step as 1, 2, 3 and my reports come out very clean and crisp. While I've created other reports in Birth, they've all been textual in nature and this is the first with images