Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Decreasing image quality in PDF-Export
Decreasing image quality in PDF-Export [message #882026] Tue, 05 June 2012 16:49 Go to next message
Thomas Thym is currently offline Thomas ThymFriend
Messages: 5
Registered: June 2012
Junior Member
Hi,

I have written a report generating a price list with images of the product. The pictures have a resolution of 300 dpi. The exported PDF-file goes to the printer. The 50MB file is too big for the download from the internet. (The internet version is individual for each customer with individual prices.)

My aim is to reduce the resolution of the report to 96 dpi. I searched the internet and found some hints.

I tried the following things with no effect.

1. Properties -> Advanced -> Image DPI -> set to 96

2. Add a script to "beforeRender"
reportContext.getAppContext().put( EngineConstants.APPCONTEXT_CHART_RESOLUTION, 96 );
[This one might only work for charts, not for images, but I tried it.]

3. Add a script to "beforeRender"
var options = new PDFRenderOption();
options.setOption(IPDFRenderOption.DPI, 96);

... and many variations.

If would be great if you could give me some hints where I could look into.

Thomas

P.S.: I use birt-rcp-report-designer 3.7.2
Re: Decreasing image quality in PDF-Export [message #882121 is a reply to message #882026] Tue, 05 June 2012 22:22 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Take a look at this :
http://www.eclipse.org/birt/phoenix/project/notable2.5.php#jump_16

Also set the height and width for the image to blank and then set the
advanced property for dpi. You may also want to look at the fit to
container to put your image in a grid cell that is sized smaller than
your image.

Jason

On 6/5/2012 12:49 PM, Thomas Thym wrote:
> Hi,
>
> I have written a report generating a price list with images of the
> product. The pictures have a resolution of 300 dpi. The exported
> PDF-file goes to the printer. The 50MB file is too big for the download
> from the internet. (The internet version is individual for each customer
> with individual prices.)
>
> My aim is to reduce the resolution of the report to 96 dpi. I searched
> the internet and found some hints.
> I tried the following things with no effect.
>
> 1. Properties -> Advanced -> Image DPI -> set to 96
>
> 2. Add a script to "beforeRender"
> reportContext.getAppContext().put(
> EngineConstants.APPCONTEXT_CHART_RESOLUTION, 96 );
> [This one might only work for charts, not for images, but I tried it.]
>
> 3. Add a script to "beforeRender"
> var options = new PDFRenderOption();
> options.setOption(IPDFRenderOption.DPI, 96);
>
> ... and many variations.
>
> If would be great if you could give me some hints where I could look into.
>
> Thomas
>
> P.S.: I use birt-rcp-report-designer 3.7.2
>
Re: Decreasing image quality in PDF-Export [message #882125 is a reply to message #882121] Tue, 05 June 2012 22:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

BTW if you are using charts and you want the pdf smaller make sure to
set the chart type to something like png. SVG produces better image
quality on charts but larger pdfs.

Jason

On 6/5/2012 6:22 PM, Jason Weathersby wrote:
>
> Take a look at this :
> http://www.eclipse.org/birt/phoenix/project/notable2.5.php#jump_16
>
> Also set the height and width for the image to blank and then set the
> advanced property for dpi. You may also want to look at the fit to
> container to put your image in a grid cell that is sized smaller than
> your image.
>
> Jason
>
> On 6/5/2012 12:49 PM, Thomas Thym wrote:
>> Hi,
>>
>> I have written a report generating a price list with images of the
>> product. The pictures have a resolution of 300 dpi. The exported
>> PDF-file goes to the printer. The 50MB file is too big for the download
>> from the internet. (The internet version is individual for each customer
>> with individual prices.)
>>
>> My aim is to reduce the resolution of the report to 96 dpi. I searched
>> the internet and found some hints.
>> I tried the following things with no effect.
>>
>> 1. Properties -> Advanced -> Image DPI -> set to 96
>>
>> 2. Add a script to "beforeRender"
>> reportContext.getAppContext().put(
>> EngineConstants.APPCONTEXT_CHART_RESOLUTION, 96 );
>> [This one might only work for charts, not for images, but I tried it.]
>>
>> 3. Add a script to "beforeRender"
>> var options = new PDFRenderOption();
>> options.setOption(IPDFRenderOption.DPI, 96);
>>
>> ... and many variations.
>>
>> If would be great if you could give me some hints where I could look
>> into.
>>
>> Thomas
>>
>> P.S.: I use birt-rcp-report-designer 3.7.2
>>
>
Re: Decreasing image quality in PDF-Export [message #882269 is a reply to message #882125] Wed, 06 June 2012 06:48 Go to previous messageGo to next message
Thomas Thym is currently offline Thomas ThymFriend
Messages: 5
Registered: June 2012
Junior Member
Thanks for the hints. I have set the image width. So I have a look into the links and try again.
Re: Decreasing image quality in PDF-Export [message #882306 is a reply to message #882269] Wed, 06 June 2012 08:15 Go to previous messageGo to next message
Thomas Thym is currently offline Thomas ThymFriend
Messages: 5
Registered: June 2012
Junior Member
I read the document and tried a couple of things.

In the viewer the image remains at the large scale and is cut at the end of the container (only width is defined, the hight should be automatic according to the proportional value of the image).

In the PDF the image has the right dimensions 5 cm wide, but the resolution remains the same.

I tried:

Image:
- Proportional scale: true/false
- Fit to container: true/false
- width: blanc (setting the width is showing the image in the right size but the resolution is too high; according to your link the width should be empty)

Container (Grid):
- Can shrink: true/false
- width 5 cm
- hight (3 in) => no effect.
- Display: Block / Inline

Container (Column of grid):
- Can shrink: true/false
- width: 5 cm / 40 mm / 3 in / blanc

Container (Row of grid):
- hight: 4 in => image is cut at 4in, not scaled in the viewer.

Report:
- Image DPI: 0 / 96 / 120

Thanks for your help.
Thomas
Re: Decreasing image quality in PDF-Export [message #882654 is a reply to message #882306] Wed, 06 June 2012 23:29 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Thomas,

I was able to get the image to scale down but the pdf size had very
little difference. Take a look at the attached example. Change the dpi
to something like 300 and then back to 96.

Jason

On 6/6/2012 4:15 AM, Thomas Thym wrote:
> I read the document and tried a couple of things.
>
> In the viewer the image remains at the large scale and is cut at the end
> of the container (only width is defined, the hight should be automatic
> according to the proportional value of the image).
>
> In the PDF the image has the right dimensions 5 cm wide, but the
> resolution remains the same.
>
> I tried:
>
> Image: - Proportional scale: true/false
> - Fit to container: true/false
> - width: blanc (setting the width is showing the image in the right size
> but the resolution is too high; according to your link the width should
> be empty)
>
> Container (Grid): - Can shrink: true/false
> - width 5 cm - hight (3 in) => no effect.
> - Display: Block / Inline
>
> Container (Column of grid): - Can shrink: true/false
> - width: 5 cm / 40 mm / 3 in / blanc
>
> Container (Row of grid): - hight: 4 in => image is cut at 4in, not
> scaled in the viewer.
>
> Report:
> - Image DPI: 0 / 96 / 120
>
> Thanks for your help.
> Thomas
>
  • Attachment: ImageDPI.zip
    (Size: 9.77KB, Downloaded 920 times)
Re: Decreasing image quality in PDF-Export [message #884721 is a reply to message #882654] Mon, 11 June 2012 17:14 Go to previous messageGo to next message
Thomas Thym is currently offline Thomas ThymFriend
Messages: 5
Registered: June 2012
Junior Member
Hi Jason,

thank you very much for your efforts.
I tried your example and experimented with an own image (higher resolution) but had no success. The variation of the filesize went away when I deleted the footer in the master page (date, time).

I succeeded in keeping the image size the same, but I had no success reducing the image resolution (in the PDF).

As workaround I will have two directories of the images. One with 96 dpi and the other with 300 dpi. According to a parameter setting BIRT will fetch the images from one of those directories.

Thanks for your help.

Thomas
Re: Decreasing image quality in PDF-Export [message #884729 is a reply to message #884721] Mon, 11 June 2012 17:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Thomas,

Thanks for the update. Any chance you could log a bugzilla entry to
improve the behavior?

Jason

On 6/11/2012 1:14 PM, Thomas Thym wrote:
> Hi Jason,
>
> thank you very much for your efforts. I tried your example and
> experimented with an own image (higher resolution) but had no success.
> The variation of the filesize went away when I deleted the footer in the
> master page (date, time).
>
> I succeeded in keeping the image size the same, but I had no success
> reducing the image resolution (in the PDF).
>
> As workaround I will have two directories of the images. One with 96 dpi
> and the other with 300 dpi. According to a parameter setting BIRT will
> fetch the images from one of those directories.
>
> Thanks for your help.
>
> Thomas
>
Re: Decreasing image quality in PDF-Export [message #885122 is a reply to message #884729] Tue, 12 June 2012 13:52 Go to previous messageGo to next message
Thomas Thym is currently offline Thomas ThymFriend
Messages: 5
Registered: June 2012
Junior Member
Jason,

I filed a bug report: Bug 382371
bugs.eclipse.org/bugs/show_bug.cgi?id=382371

Thomas
Re: Decreasing image quality in PDF-Export [message #885183 is a reply to message #885122] Tue, 12 June 2012 15:04 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Thomas

Thanks for logging this.

Jason

On 6/12/2012 9:52 AM, Thomas Thym wrote:
> Jason,
>
> I filed a bug report: Bug 382371
> bugs.eclipse.org/bugs/show_bug.cgi?id=382371
>
> Thomas
>
Previous Topic:org.eclipse.birt.core.archive.FolderArchive Example?
Next Topic:Missing pre-defined styles for grid-row, grid-cell, table-row, table-cell
Goto Forum:
  


Current Time: Fri Mar 29 01:16:32 GMT 2024

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

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

Back to the top