Created pdf cannot be oppened using Acrobat #160

Closed
opened 1 year ago by Ben · 8 comments
Ben commented 1 year ago

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,

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.
Ben commented 1 year ago
Poster

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"
Ben commented 1 year ago
Poster

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.

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`
Ben commented 1 year ago
Poster

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 1 year ago
Ben reopened this issue 1 year ago
Ben commented 1 year ago
Poster

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.
josch commented 1 year ago
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.
Ben commented 12 months ago
Poster

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 12 months ago
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
Loading…
There is no content yet.