My PDF is 50x larger than it needs to be!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

My PDF is 50x larger than it needs to be!

Peter Hansson
I'm adding an SVG logo to every page of a document in a <fo:static-content> element
and notice that the logo gets "inlined" on every page, rather than appearing

only once in the PDF file and then referenced when used on each page.

Thus the size of the PDF balloons with number of pages. Ouch!


Here's what I do:


http://stackoverflow.com/questions/41220101/xml-fo-how-to-re-use-graphics



As can be seen there's only a single character on each page (Just to make the example
simple). If I from this generate a 2 page PDF document it will be 13 KB, but if

I generate a similar 50 page document it will be 215 KB !!

I would have expected the two PDF document to be almost the same size.

How can I achieve that the logo (or header as a whole) is re-used and referenced
instead of inlined for each and every page?


By the way: Not using vector graphics is not an option for me.


Apache FOP 2.1, Java 8, PDF output




Thanks

Peter

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

Reply | Threaded
Open this post in threaded view
|

RE: My PDF is 50x larger than it needs to be!

Simon Steiner
Hi,

If you get the issue on fop trunk then you can raise a bug about it on jira.

Thanks

-----Original Message-----
From: Peter Hansson [mailto:[hidden email]]
Sent: 20 January 2017 11:16
To: [hidden email]
Subject: My PDF is 50x larger than it needs to be!

I'm adding an SVG logo to every page of a document in a <fo:static-content> element and notice that the logo gets "inlined" on every page, rather than appearing

only once in the PDF file and then referenced when used on each page.

Thus the size of the PDF balloons with number of pages. Ouch!


Here's what I do:


http://stackoverflow.com/questions/41220101/xml-fo-how-to-re-use-graphics



As can be seen there's only a single character on each page (Just to make the example simple). If I from this generate a 2 page PDF document it will be 13 KB, but if

I generate a similar 50 page document it will be 215 KB !!

I would have expected the two PDF document to be almost the same size.

How can I achieve that the logo (or header as a whole) is re-used and referenced instead of inlined for each and every page?


By the way: Not using vector graphics is not an option for me.


Apache FOP 2.1, Java 8, PDF output




Thanks

Peter

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



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

Reply | Threaded
Open this post in threaded view
|

Re: My PDF is 50x larger than it needs to be!

Peter Hansson
Happy to report that this is fixed in trunk.


On my simple XSL which generates 50 pages, the resulting PDF size is now 196 KB when using fop v2.1, but only 21 KB when using fop trunk. (as of today)


So clearly, something has happened since v2.1 was released in jan 2016. Thanks for this. Whatever you did this is *not* an insignificant bug fix.


Hoping for an official 2.2 release soon.


Thanks

Peter







> On Friday, January 20, 2017 12:24 PM, Simon Steiner <[hidden email]> wrote:
> > Hi,
>
> If you get the issue on fop trunk then you can raise a bug about it on jira.
>
> Thanks
>
> -----Original Message-----
> From: Peter Hansson [mailto:[hidden email]]
> Sent: 20 January 2017 11:16
> To: [hidden email]
> Subject: My PDF is 50x larger than it needs to be!
>
> I'm adding an SVG logo to every page of a document in a
> <fo:static-content> element and notice that the logo gets
> "inlined" on every page, rather than appearing
>
> only once in the PDF file and then referenced when used on each page.
>
> Thus the size of the PDF balloons with number of pages. Ouch!
>
>
> Here's what I do:
>
>
> http://stackoverflow.com/questions/41220101/xml-fo-how-to-re-use-graphics
>
>
>
> As can be seen there's only a single character on each page (Just to make
> the example simple). If I from this generate a 2 page PDF document it will be 13
> KB, but if
>
> I generate a similar 50 page document it will be 215 KB !!
>
> I would have expected the two PDF document to be almost the same size.
>
> How can I achieve that the logo (or header as a whole) is re-used and referenced
> instead of inlined for each and every page?
>
>
> By the way: Not using vector graphics is not an option for me.
>
>
> Apache FOP 2.1, Java 8, PDF output
>
>
>
>
> Thanks
>
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

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

Reply | Threaded
Open this post in threaded view
|

Re: My PDF is 50x larger than it needs to be!

Peter Hansson
Unfortunately this was wrong. Apparently something has happened in Trunk

that makes it realize if body content is the same or it can compress or
whatever.

In any case when I make my content on each page different

(rather than just a simple 'X' on each page) then I'm kinda back

where the PDF file becomes 50 times too big. My test case now use

the body text "Page xx" (where xx is a number 1-50) on every page

just as to be sure that content is actually different
on each page.


Darn. I thought this was fixed. I've logged FOP-2681 in JIRA.
(https://issues.apache.org/jira/browse/FOP-2681).


Thanks


Peter






> On Friday, January 20, 2017 1:41 PM, Peter Hansson <[hidden email]> wrote:
> > Happy to report that this is fixed in trunk.
>
>
> On my simple XSL which generates 50 pages, the resulting PDF size is now 196 KB
> when using fop v2.1, but only 21 KB when using fop trunk. (as of today)
>
>
> So clearly, something has happened since v2.1 was released in jan 2016. Thanks
> for this. Whatever you did this is *not* an insignificant bug fix.
>
>
> Hoping for an official 2.2 release soon.
>
>
> Thanks
>
> Peter
>
>
>
>
>
>
>
>>  On Friday, January 20, 2017 12:24 PM, Simon Steiner
> <[hidden email]> wrote:
>>  > Hi,
>>
>>  If you get the issue on fop trunk then you can raise a bug about it on
> jira.
>>
>>  Thanks
>>
>>  -----Original Message-----
>>  From: Peter Hansson [mailto:[hidden email]]
>>  Sent: 20 January 2017 11:16
>>  To: [hidden email]
>>  Subject: My PDF is 50x larger than it needs to be!
>>
>>  I'm adding an SVG logo to every page of a document in a
>>  <fo:static-content> element and notice that the logo gets
>>  "inlined" on every page, rather than appearing
>>
>>  only once in the PDF file and then referenced when used on each page.
>>
>>  Thus the size of the PDF balloons with number of pages. Ouch!
>>
>>
>>  Here's what I do:
>>
>>
>>  http://stackoverflow.com/questions/41220101/xml-fo-how-to-re-use-graphics
>>
>>
>>
>>  As can be seen there's only a single character on each page (Just to
> make
>>  the example simple). If I from this generate a 2 page PDF document it will
> be 13
>>  KB, but if
>>
>>  I generate a similar 50 page document it will be 215 KB !!
>>
>>  I would have expected the two PDF document to be almost the same size.
>>
>>  How can I achieve that the logo (or header as a whole) is re-used and
> referenced
>>  instead of inlined for each and every page?
>>
>>
>>  By the way: Not using vector graphics is not an option for me.
>>
>>
>>  Apache FOP 2.1, Java 8, PDF output
>>
>>
>>
>>
>>  Thanks
>>
>>  Peter
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: [hidden email]
>>  For additional commands, e-mail: [hidden email]
>>
>>
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: [hidden email]
>>  For additional commands, e-mail: [hidden email]
>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

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