Quantcast

PDF size reduction

Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PDF size reduction

spoorthi myneni - TECRA
Hi Team,

We have a requirement to reduce the size of the PDF size from 200Kb(approximately) to as less as possible. There are 5 images in the PDF that I am using. 

PDF size without images is coming up to 40Kb. 
Each Image size(jpegs): CCX logo- 60Kb, 3 small images: 18kb each, SMS logo - 50Kb approximately.

The PDF size is increased as mush as the image size is. Is there a way for us to optimize the image size or the PDF size in FO?
I have already set this property: </disable-srgb-colorspace>true</disable-srgb-colorspace>


Please let me know if there are any techniques to achieve this. Has there been any enhancements done in the FOP 2.0?

Thank you,
Spoorthi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF size reduction

Frank Hirsch
Personally I use Apache FOP for some projects - but I am not quite an expert when it comes to Java…

As far as I understand you may want to adjust the image resolution/compression to shrink the size of the files used in you FO - but I am not sure if this can be done automatically using a different image handling subsystem (https://xmlgraphics.apache.org/fop/0.95/graphics.html). Changing the color space may only affect the color profile/representation, but I don’t think this will preprocess the image size at all (sRGB is just a smaller gamut than Adobe RGB and RGB) - you may just get a different representation of colors outside the given gammut!

From my perspective, it’s the same thing as placing an image in a layout software: the image will be used „as is“. Only when it comes to write the PDF you may have the ability to „donwsample“ all images to a given resolution relative to the size in the layout…

- One solution might be to adjust the images to a proper size and compression accordingly to the layout
- Alternatively you may „optimize“ the PDF for internet use: resample, compress and remove duplicates (images used multiple times)

Just a few ideas which may help if there is no native solution in Apache FOP ;-)
If there is no working solution in FOP, I may send you a link to a freeware to optimize the final PDF

The FOP guys may forgive me if I am completely wrong ;-)

Best,
Frank

Am 16.05.2017 um 17:50 schrieb spoorthi myneni - TECRA <[hidden email]>:

Hi Team,

We have a requirement to reduce the size of the PDF size from 200Kb(approximately) to as less as possible. There are 5 images in the PDF that I am using. 

PDF size without images is coming up to 40Kb. 
Each Image size(jpegs): CCX logo- 60Kb, 3 small images: 18kb each, SMS logo - 50Kb approximately.

The PDF size is increased as mush as the image size is. Is there a way for us to optimize the image size or the PDF size in FO?
I have already set this property: </disable-srgb-colorspace>true</disable-srgb-colorspace>


Please let me know if there are any techniques to achieve this. Has there been any enhancements done in the FOP 2.0?

Thank you,
Spoorthi

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF size reduction

Peter Hansson
Hi Spoorthi

Another angle:
I've found SVGs to be MUCH MORE efficient in terms of space usage. Try to see if you have those logos in SVG format instead and see if it helps.

The added bonus of doing this is that image still looks nice even when the end-user is using the zoom function when looking at the PDF document.

SVGs cannot do everything that say JPEG can. For example Apache FOP doesn't have support for SVGs that use gradients. However, I've found that most corporate logos aren't that advanced and they typically work well with SVG format.

Give it a try.
For example something like this:

 <fo:external-graphic  .... src="../my-company-logo.svg"/>


Peter



On Tuesday, May 16, 2017 6:55 PM, Frank Hirsch <[hidden email]> wrote:


Personally I use Apache FOP for some projects - but I am not quite an expert when it comes to Java…

As far as I understand you may want to adjust the image resolution/compression to shrink the size of the files used in you FO - but I am not sure if this can be done automatically using a different image handling subsystem (https://xmlgraphics.apache.org/fop/0.95/graphics.html). Changing the color space may only affect the color profile/representation, but I don’t think this will preprocess the image size at all (sRGB is just a smaller gamut than Adobe RGB and RGB) - you may just get a different representation of colors outside the given gammut!

From my perspective, it’s the same thing as placing an image in a layout software: the image will be used „as is“. Only when it comes to write the PDF you may have the ability to „donwsample“ all images to a given resolution relative to the size in the layout…

- One solution might be to adjust the images to a proper size and compression accordingly to the layout
- Alternatively you may „optimize“ the PDF for internet use: resample, compress and remove duplicates (images used multiple times)

Just a few ideas which may help if there is no native solution in Apache FOP ;-)
If there is no working solution in FOP, I may send you a link to a freeware to optimize the final PDF

The FOP guys may forgive me if I am completely wrong ;-)

Best,
Frank

Am 16.05.2017 um 17:50 schrieb spoorthi myneni - TECRA <[hidden email]>:

Hi Team,

We have a requirement to reduce the size of the PDF size from 200Kb(approximately) to as less as possible. There are 5 images in the PDF that I am using. 

PDF size without images is coming up to 40Kb. 
Each Image size(jpegs): CCX logo- 60Kb, 3 small images: 18kb each, SMS logo - 50Kb approximately.

The PDF size is increased as mush as the image size is. Is there a way for us to optimize the image size or the PDF size in FO?
I have already set this property: </disable-srgb-colorspace>true</disable-srgb-colorspace>


Please let me know if there are any techniques to achieve this. Has there been any enhancements done in the FOP 2.0?

Thank you,
Spoorthi



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF size reduction

Tobias van Treeck
Another possibility is to post process your PDF. We for instance first generate the PDF and afterwards use some other PDF library to shrink the images and remove unused objects and other stuff...
If something is possible with a PDF in question you may try out with acrobat - there are options to optimize and shrink your PDF. If there is no reduction in file size with those options you may already have the perfect PDF without any overhead ;-)

2017-05-16 22:10 GMT+02:00 Peter Hansson <[hidden email]>:
Hi Spoorthi

Another angle:
I've found SVGs to be MUCH MORE efficient in terms of space usage. Try to see if you have those logos in SVG format instead and see if it helps.

The added bonus of doing this is that image still looks nice even when the end-user is using the zoom function when looking at the PDF document.

SVGs cannot do everything that say JPEG can. For example Apache FOP doesn't have support for SVGs that use gradients. However, I've found that most corporate logos aren't that advanced and they typically work well with SVG format.

Give it a try.
For example something like this:

 <fo:external-graphic  .... src="../my-company-logo.svg"/>


Peter



On Tuesday, May 16, 2017 6:55 PM, Frank Hirsch <[hidden email]> wrote:


Personally I use Apache FOP for some projects - but I am not quite an expert when it comes to Java…

As far as I understand you may want to adjust the image resolution/compression to shrink the size of the files used in you FO - but I am not sure if this can be done automatically using a different image handling subsystem (https://xmlgraphics.apache.org/fop/0.95/graphics.html). Changing the color space may only affect the color profile/representation, but I don’t think this will preprocess the image size at all (sRGB is just a smaller gamut than Adobe RGB and RGB) - you may just get a different representation of colors outside the given gammut!

From my perspective, it’s the same thing as placing an image in a layout software: the image will be used „as is“. Only when it comes to write the PDF you may have the ability to „donwsample“ all images to a given resolution relative to the size in the layout…

- One solution might be to adjust the images to a proper size and compression accordingly to the layout
- Alternatively you may „optimize“ the PDF for internet use: resample, compress and remove duplicates (images used multiple times)

Just a few ideas which may help if there is no native solution in Apache FOP ;-)
If there is no working solution in FOP, I may send you a link to a freeware to optimize the final PDF

The FOP guys may forgive me if I am completely wrong ;-)

Best,
Frank

Am 16.05.2017 um 17:50 schrieb spoorthi myneni - TECRA <[hidden email]>:

Hi Team,

We have a requirement to reduce the size of the PDF size from 200Kb(approximately) to as less as possible. There are 5 images in the PDF that I am using. 

PDF size without images is coming up to 40Kb. 
Each Image size(jpegs): CCX logo- 60Kb, 3 small images: 18kb each, SMS logo - 50Kb approximately.

The PDF size is increased as mush as the image size is. Is there a way for us to optimize the image size or the PDF size in FO?
I have already set this property: </disable-srgb-colorspace>true</disable-srgb-colorspace>


Please let me know if there are any techniques to achieve this. Has there been any enhancements done in the FOP 2.0?

Thank you,
Spoorthi




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PDF size reduction

Mathieu Malaterre-2
In reply to this post by spoorthi myneni - TECRA
Hi,

If you have not done it first, I would remove the exif stuff from the
JPEG file. And then give `jpegoptim` a try to reduce the JPEG file
size first:

https://github.com/tjko/jpegoptim

-M

On Tue, May 16, 2017 at 5:50 PM, spoorthi myneni - TECRA
<[hidden email]> wrote:

> Hi Team,
>
> We have a requirement to reduce the size of the PDF size from
> 200Kb(approximately) to as less as possible. There are 5 images in the PDF
> that I am using.
>
> PDF size without images is coming up to 40Kb.
> Each Image size(jpegs): CCX logo- 60Kb, 3 small images: 18kb each, SMS logo
> - 50Kb approximately.
>
> The PDF size is increased as mush as the image size is. Is there a way for
> us to optimize the image size or the PDF size in FO?
> I have already set this property:
> </disable-srgb-colorspace>true</disable-srgb-colorspace>
>
>
> Please let me know if there are any techniques to achieve this. Has there
> been any enhancements done in the FOP 2.0?
>
> Thank you,
> Spoorthi



--
Mathieu

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...