Created pdf cannot be oppened using Acrobat #160

Closed
opened 2023-03-30 15:54:26 +00:00 by Ben · 8 comments

Hello,

I am trying to convert the following image to pdf succeed but the created pdf cannot be openned using Acrobat reader.

with open("10000057.pdf", "wb") as f:
    f.write(img2pdf.convert('10000057.jpg'))

Regards,

Hello, I am trying to convert the following image to pdf succeed but the created pdf cannot be openned using Acrobat reader. ``` with open("10000057.pdf", "wb") as f: f.write(img2pdf.convert('10000057.jpg')) ``` Regards,
Contributor

Is it possible that you uploaded a wrong file?
The PDF seems to contain a different image than the input JPG you provided.
And looking at the metadata, your PDF does not show img2pdf as producer.

Is it possible that you uploaded a wrong file? The PDF seems to contain a different image than the input JPG you provided. And looking at the metadata, your PDF does not show img2pdf as producer.
Author

Might be possible, i made several tests before posting.
Please find below the pdf I just regenerated.

Version of img2pdf = "0.3.6"

Might be possible, i made several tests before posting. Please find below the pdf I just regenerated. Version of img2pdf = "0.3.6"
Author

Upgrading to the last version of img2pdf ("0.4.4") does not solve the problem.

Upgrading to the last version of img2pdf ("0.4.4") does not solve the problem.
Contributor

That looks better, but still img2pdf is not shown as producer in the metadata.
Are you doing any kind of post-processing to the PDF?

Could you try using the vanilla img2pdf CLI, and then check if Adobe Reader opens the result, to rule out an issue with your own code? img2pdf 10000057.jpg -o out.pdf

That looks better, but still img2pdf is not shown as producer in the metadata. Are you doing any kind of post-processing to the PDF? Could you try using the vanilla img2pdf CLI, and then check if Adobe Reader opens the result, to rule out an issue with your own code? `img2pdf 10000057.jpg -o out.pdf`
Author

No, no post treatment, I just run the two lines of python given in my first post.

Please find attached the result of img2pdf 10000057.jpg -o out.pdf

I still get the same problem on my side.

No, no post treatment, I just run the two lines of python given in my first post. Please find attached the result of `img2pdf 10000057.jpg -o out.pdf` I still get the same problem on my side.
255 KiB
Ben closed this issue 2023-04-05 09:13:15 +00:00
Ben reopened this issue 2023-04-05 09:14:02 +00:00
Author

If it might help, I succeeded to fix the file out.pdf by using https://www.ilovepdf.com/.

Please find attached the fixed file.

If it might help, I succeeded to fix the file out.pdf by using https://www.ilovepdf.com/. Please find attached the fixed file.
Owner

It is no surprise that your new pdf works, because it re-encoded the included JPEG (which results in quality loss).

It is likely that adobe acrobat does not like somthing about the JPEG in your original pdf. Try to convert the jpeg into another jpeg using a tool of your choice and then running img2pdf again on the new file.

If acrobat reads that new file, then something was "wrong" with your old jpeg.

In that case, this is not a bug in img2pdf but a bug in acrobat because all pdf viewers i tried (evince, mupdf, firefox, chromium, libre office, gimp, inkscape) can open the pdf you showed just fine.

It is no surprise that your new pdf works, because it re-encoded the included JPEG (which results in quality loss). It is likely that adobe acrobat does not like somthing about the JPEG in your original pdf. Try to convert the jpeg into another jpeg using a tool of your choice and then running img2pdf again on the new file. If acrobat reads that new file, then something was "wrong" with your old jpeg. In that case, this is not a bug in img2pdf but a bug in acrobat because all pdf viewers i tried (evince, mupdf, firefox, chromium, libre office, gimp, inkscape) can open the pdf you showed just fine.
Author

Hello,

I found a solution by reworking jpegs before img2pdf transformation.

The ticket is solved.

Thanks for your answers and your help.

Hello, I found a solution by reworking jpegs before img2pdf transformation. The ticket is solved. Thanks for your answers and your help.
Ben closed this issue 2023-05-25 08:13:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#160
No description provided.