zhihongzzh / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

Absolute positioned elements with borders produces border boxes duplicated on every page in multi-page PDF #191

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Take multi-page html with absolute positioned elements on different pages.

2. Generate PDF using ITextRenderer

What is the expected output? 
Every element should appear in PDF only once.

What do you see instead?
CSS borders of absolute positioned elements produces boxes duplicated on every 
page in multi-page PDF.
Size of resulting PDF grows non-linear. For example we see 300-pages document 
having 52 Mb size. After fix size dropped to 500 Kb.

What version of the product are you using? R8
On what operating system? any

Attached patch prevents rendering of layers not intersected with current 
rendering page.

Original issue reported on code.google.com by igor.pot...@gmail.com on 17 Feb 2012 at 9:32

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

I'm trying to use this patch for fixed positioned elements.

But now footers aren't printed anymore...

Thanks,

Teun Hoogendoorn

Original comment by teunhoog...@gmail.com on 19 Jul 2012 at 2:30

GoogleCodeExporter commented 8 years ago
Hi, Teun.

It is very possible that I missed your case, because tested only pages without 
footers.
I'll review patch and try to make fix.

Thanks for information.

Igor E. Poteryaev

Original comment by igor.pot...@gmail.com on 19 Jul 2012 at 6:35

GoogleCodeExporter commented 8 years ago
> I'm trying to use this patch for fixed positioned elements.

Hi, Teun.

I have updated patch. 
Test for absolute positioned element intercetion with current page was modev 
AFTER painting of fixed elements.

Igor E. Poteryaev

Original comment by igor.pot...@gmail.com on 7 Dec 2012 at 12:42

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Igor,

Thanks to your patch I was able to reduce a 2600 page PDF from 1.3 GB to 60 MB!

In order to get page headers and footers included I had to modify the patch so 
that root layer would always be painted. In other words, I changed "if (! 
isLayerBelongsToPage(c))" to "if (! isRootLayer() && ! 
isLayerBelongsToPage(c))".

Thanks again,
Olli Nevalainen

Original comment by olli.nev...@gmail.com on 21 Mar 2013 at 11:28