pdf-rs / pdf_render

MIT License
104 stars 21 forks source link

PDF Rendering issues #14

Open DorianRudolph opened 1 year ago

DorianRudolph commented 1 year ago

Hey,

I just tried this out with a random PDF from my download folder, and there seem to be a couple of issues: https://leica-camera.com/sites/default/files/pm-73760-Leica-SL2_Technical-Data_en.pdf

First page (pdf_render, evince):

image

image

The first issue is in the title. Analyzing the PDF in Master PDF editor, one can see that there is the text "DAS WESENTLICHE" but with clipping path and white font behind the "LEICA SL2" text. So the clipping did not work in pdf_render.

The technical drawings are also present thrice, but two copies are clipped (I think).

Another image (pdf_render, evice): image

image

In this picture, I see two issues: Missing special characters (e.g. TM), and missing gray outlines of text hanging over the gray box. These outlines are created by "Stroke Text" (opposed to normal "Fill Text", at least that is term Master PDF uses).

image

The camera body is too dark (the texture is still there, but I have to increase brightness to see it). Also, there is a gray line around the left and top border of the image (not visible at every zoom level).

zoomed out (pdf_render, evice):

image

image

I think when you zoom out far, you are supposed to render certain lines at a width of at least 1px per PDF specification.

s3bk commented 1 year ago

I think when you zoom out far, you are supposed to render certain lines at a width of at least 1px per PDF specification.

Yes, but it makes no sense, so I did not implement it that way. It would make rendering a PDF depend on the resolution of the output...

In this picture, I see two issues: Missing special characters (e.g. TM), and missing gray outlines of text hanging over the gray box. These outlines are created by "Stroke Text" (opposed to normal "Fill Text", at least that is term Master PDF uses).

If they use one of the standard fonts, then that is quite possible; and only they and Adobe are to blame for not distributing them freely.

And yes, the current clipping implementation is a hack at best. Unfortunately Pathfinder does not implement clipping, so it would need to be done with a geometry library.