You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Luis Bernardo <lm...@gmail.com> on 2013/06/01 00:25:16 UTC

Re: reduce size of PDF generated with FOP

An image is only embedded once in PDF if you always refer to it by the
same URI, no matter how many times you refer to it. So I don't think
that is the issue.

Can you send an simple example of a PDF with just an image generated
by Framemaker and by FOP so that we can investigate the difference.

On 5/30/13, chandone <ec...@yahoo.com> wrote:
> Hello everyone,
>
> I use Java, XSL-FO and FOP to generate PDFs that consist in one or more
> pages of data and images, each page having a header and a footer containing
> images themselves. These header and footer are repeated on each and every
> page of the PDF documents. The images are responsible for a large part of
> the size of the resulting PDF (about 50 %). I noticed that, by converting
> them from JPEG to TIFF, and by reducing their resolution, I was able to
> reduce considerably the size of the PDF as well. But I now have the feeling
> that I have reached a dead-end as far as images as concerned.
>
> The PDFs are still very huge, compared to those that used to be generated
> with FrameMaker, the Adobe PDF generation system that we're willing to get
> rid of. And I'm sorry to say that I can't think of another way to reduce
> the
> PDFs' size, as the Web mainly talks about pre-processing images in order to
> make PDFs smaller. I was wondering whether, maybe, it would be possible in
> a
> way or another to tell FOP to repeat the images in all headers and footers
> in some kind of way so that the images would be embedded only once in the
> document and just "mirrored" on the other pages. Plus, there ought to be
> other ways to reduce the PDF size, apart from images, don't you think?
>
> I would highly appreciate any advice on this topic. Thanks a lot in advance
> for your time and help.
>
> Erwann
>
>
>
> --
> View this message in context:
> http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: reduce size of PDF generated with FOP

Posted by chandone <ec...@yahoo.com>.
I'm sorry that I don't follow this post up on a more regular basis but I've
been pretty busy with other stuff here at work.
Fonts are indeed embedded more than once in merged PDFs. I'm going to look
into it, maybe try and merge them a different way.
As for the individual PDFs, I managed to reduce their size by a considerable
amount by dividing the resolution of images by a factor of 2: 150 dpi
instead of 300 dpi do the trick. The files are still bigger than the ones
generated by FrameMaker (76 KB) but 160 KB is still better than 380 KB. Such
a resolution is not satisfactory for printing but is good enough for an
on-screen viewing.
I should be able to provide you with sample PDFs at the end of the week.



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619p38683.html
Sent from the FOP - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: reduce size of PDF generated with FOP

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
I'd second Luis assumption but having a PDF for further analysis would be good. Feel free to open a case at PDFBox - I'll look into it.

BR
Maruan

Am 04.06.2013 um 11:27 schrieb Luis Bernardo <lm...@gmail.com>:

> Very likely the pdfbox merge utility does not merge the fonts used in the documents. So if you have the same font used in two documents the font will be embedded twice in the merged document. If you have many fonts the size can grow considerably.
> 
> If you think the difference in size in the individual PDFs is an issue send us a sample example to that we can investigate the reason for the difference. 
> 
> 
> On Tue, Jun 4, 2013 at 9:57 AM, chandone <ec...@yahoo.com> wrote:
>> Is it indeed? Well, the fact is that I generate PDFs in two different ways:
>> 
>> - individual PDFs,
>> - the same PDFs, but concatenated together into one big PDF, using the
>> Apache pdfbox PDFMergerUtility.mergeDocuments() method.
>> 
>> Compared to the ones generated by FrameMaker, the individual PDFs grow from
>> 50-60 KB to 100-150 KB. In these PDF, the header and footer images are
>> present only once.
>> In the second case, the images are obviously repeated lots of times and the
>> document grow from 1-2 MB to 23 MB. In this case, I assume that, as the
>> images are originally part of separated document that were then merged, they
>> are actually present lots of times in the global document. But, as I said
>> before, images are not responsible for the huge size of the PDF alone, as
>> when I remove them the PDF is still 21 MB.
>> I'm afraid I am not at liberty to divulge the PDFs I'm referring to but I'll
>> see if I can manage to generate a dummy one. That may not be easy.
>> 
>> 
>> 
>> --
>> View this message in context: http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619p38648.html
>> Sent from the FOP - Users mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 

Re: reduce size of PDF generated with FOP

Posted by Luis Bernardo <lm...@gmail.com>.
Very likely the pdfbox merge utility does not merge the fonts used in the
documents. So if you have the same font used in two documents the font will
be embedded twice in the merged document. If you have many fonts the size
can grow considerably.

If you think the difference in size in the individual PDFs is an issue send
us a sample example to that we can investigate the reason for the
difference.


On Tue, Jun 4, 2013 at 9:57 AM, chandone <ec...@yahoo.com> wrote:

> Is it indeed? Well, the fact is that I generate PDFs in two different ways:
>
> - individual PDFs,
> - the same PDFs, but concatenated together into one big PDF, using the
> Apache pdfbox PDFMergerUtility.mergeDocuments() method.
>
> Compared to the ones generated by FrameMaker, the individual PDFs grow from
> 50-60 KB to 100-150 KB. In these PDF, the header and footer images are
> present only once.
> In the second case, the images are obviously repeated lots of times and the
> document grow from 1-2 MB to 23 MB. In this case, I assume that, as the
> images are originally part of separated document that were then merged,
> they
> are actually present lots of times in the global document. But, as I said
> before, images are not responsible for the huge size of the PDF alone, as
> when I remove them the PDF is still 21 MB.
> I'm afraid I am not at liberty to divulge the PDFs I'm referring to but
> I'll
> see if I can manage to generate a dummy one. That may not be easy.
>
>
>
> --
> View this message in context:
> http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619p38648.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

Re: reduce size of PDF generated with FOP

Posted by chandone <ec...@yahoo.com>.
Is it indeed? Well, the fact is that I generate PDFs in two different ways:

- individual PDFs,
- the same PDFs, but concatenated together into one big PDF, using the
Apache pdfbox PDFMergerUtility.mergeDocuments() method.

Compared to the ones generated by FrameMaker, the individual PDFs grow from
50-60 KB to 100-150 KB. In these PDF, the header and footer images are
present only once.
In the second case, the images are obviously repeated lots of times and the
document grow from 1-2 MB to 23 MB. In this case, I assume that, as the
images are originally part of separated document that were then merged, they
are actually present lots of times in the global document. But, as I said
before, images are not responsible for the huge size of the PDF alone, as
when I remove them the PDF is still 21 MB.
I'm afraid I am not at liberty to divulge the PDFs I'm referring to but I'll
see if I can manage to generate a dummy one. That may not be easy.



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619p38648.html
Sent from the FOP - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org