[poppler] Weird rendering of a very simple pdf

Adrian Johnson ajohnson at redneon.com
Fri Jul 6 02:40:59 PDT 2012


On 06/07/12 00:47, Albert Astals Cid wrote:
> I've stumbled upon this simple pdf
> 
> BT
> /F1 9 Tf
> 1 0 0 1 55 763 Tm
> 0 0 0 rg
> 51 775 497 1 re
> B
> (DADOS DO VOUCHER)Tj
> 1 1 1 RG
> 50 760 500 13 re
> 0.72549 0.83137 0.9451 rg
> B
> /F2 9 Tf
> 1 0 0 1 55 750 Tm
> 0 0 0 rg
> (Nº Voucher: )Tj
> 1 1 1 RG
> 50 747 500 13 re
> 0.86667 0.91373 0.97255 rg
> B
> ET
> 
> That renders correctly in Adobe Reader but not in poppler based files.
> 
> Any clue why?

The problem appears to be that the rectangles are painted inside the
text object. According the PDF standard, a text object consists of
operators for showing text, moving the text position, and setting text
state. It doesn't say anything about allowing graphics operators inside
a text block. If I put BT/ET around only the text operators then Adobe
Reader paints the rectangles over the text. It looks like when graphics
operators are inside a BT/ET block Adobe Reader renders the graphics
operations first then the text. If I move the graphics operations to
before the text block the pdf renders the same in both poppler and Adobe
Reader.

The incorrect position of the first text line in poppler is caused by
the "re" operator after the "Tm" operator and before the text is drawn.
Setting the path overwrites curX and curY in GfxState.

I also tested the pdf with ghostscript and my printer which supports
pdf. Ghostscript ignores the graphics operators inside the text block
and only renders the text. My printer draws the rectangles over the text.

> 
> Cheers,
>   Albert
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
> 




More information about the poppler mailing list