Stirling-Tools / Stirling-PDF

#1 Locally hosted web application that allows you to perform various operations on PDF files
GNU General Public License v3.0
30.12k stars 2.22k forks source link

Wrong image rotation on some files with `add-image` and `sign` tools #217

Open paspo opened 1 year ago

paspo commented 1 year ago

In some pdf files, when I put an image with the add-image or the sign tool, I obtain a PDF with the desired image but in a different position, with wrong dimensions and wrong rotation (always 90° ccw).

I can resolve this issue by:

There's clearly something wrong with the original files, but I don't have enough data ATM. I can safely say that this has nothing to do with PDF version (some files are 1.3, others are 1.7 ...) I can also exclude the image file format: the problem arises with jpegs, pngs...

Even if I understand that the problem is in the "somewhat broken" input files, I think that there's the possibility that solving this issue can lead to a more robust processing.

I can provide some example files to any contributor asking for it, but not publicly; DM if interested.

Thanks.

Frooodle commented 1 year ago

Can you send me the example file? I am the main contributor and admin of the discord if you want to PM me it there

paspo commented 1 year ago

For anyone to try, here's a sample file. It's a PDF generated by a MFP. scan258275.pdf

paspo commented 1 year ago

This issue is still present in 0.10.3

Ludy87 commented 3 months ago

The problem is that the orientation of the PDF in your file is 270°, which is where the incorrect ratio calculation comes from and the incorrect aurization of the image.