Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Again: weasyprint 53.2 / Adobe Acrobat Reader DC in Windows Getting PDF error 135 when opening #1440

Closed
slartibart70 opened this issue Sep 7, 2021 · 8 comments
Milestone

Comments

@slartibart70
Copy link

Hi all,
i know, this bug was mentioned (and closed) several times already,
but i am experiencing it again in fedora33 using
weasyprint 53.2 (and cairo is on version cairo-1.16.0-9.fc33.x86_64)

A pdf document that can be displayed without problems with other readers is causing error 135 in acrobat running in windows.

According to another (closed) issue, the newer version of weasyprint does not rely in cairo any more? (still, cairo v.1.16 was said to be working in comparison to newer cairo versions)

$ pdfinfo howto.md.pdf
Title: howto
Creator: pandoc
Producer: WeasyPrint 53.2
Tagged: no
UserProperties: no
Suspects: no
Form: none
JavaScript: no
Pages: 29
Encrypted: no
Page size: 595.276 x 841.89 pts (A4)
Page rot: 0
File size: 234898 bytes
Optimized: no
PDF version: 1.7

and the font list also looks fine to me (no garbled names)

$ pdffonts howto.md.pdf
name type encoding emb sub uni object ID


UKSUHJ+mySerif CID TrueType Identity-H yes yes yes 340 0
IXKWPQ+myMono CID TrueType Identity-H yes yes yes 344 0
VGKOXD+DejaVuSans CID TrueType Identity-H yes yes yes 348 0

Any help is appreciated

@slartibart70
Copy link
Author

test.md.pdf

a small sample pdf

@slartibart70
Copy link
Author

qpdf is also not happy:

$ qpdf test.md.pdf out.pdf
WARNING: test.md.pdf (object 18 0, offset 9516): unknown token while reading object; treating as string
WARNING: test.md.pdf (object 18 0, offset 9527): unknown token while reading object; treating as string
WARNING: test.md.pdf (object 18 0, offset 9533): unknown token while reading object; treating as string
WARNING: test.md.pdf (object 18 0, offset 9538): unknown token while reading object; treating as string
WARNING: test.md.pdf (object 18 0, offset 9551): unknown token while reading object; treating as string
WARNING: test.md.pdf (object 18 0, offset 9558): unknown token while reading object; treating as string
WARNING: test.md.pdf (object 18 0, offset 9558): too many errors; giving up on reading object
WARNING: test.md.pdf (object 18 0, offset 9566): expected endobj
qpdf: operation succeeded with warnings; resulting file may have some problems

@grewn0uille
Copy link
Member

Hello!
Can you please try with the 53.x branch?

@slartibart70
Copy link
Author

i cloned the repo, switched to 53.x branch and replaced the weasyprint-folder in my .local/lib/python3.9/ with the git version
(correct so far?)

recreate test.md.pdf
qpdf does not complain any more
acrobat seems ok with this version (no more error 135)

BUT
i cannot create big documents any more:

[..]
INFO: Step 5 - Creating layout - Page 22
INFO: Step 5 - Creating layout - Page 23
INFO: Step 5 - Creating layout - Page 24
INFO: Step 5 - Creating layout - Page 25
INFO: Step 5 - Creating layout - Page 26
INFO: Step 5 - Creating layout - Page 27
INFO: Step 5 - Creating layout - Page 28
INFO: Step 5 - Creating layout - Page 29
INFO: Step 6 - Creating PDF
INFO: Step 7 - Adding PDF metadata
Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 8, in <module>
    sys.exit(main())
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/__main__.py", line 214, in main
    html.write_pdf(output, **kwargs)
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/__init__.py", line 180, in write_pdf
    self.render(
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/document.py", line 1403, in write_pdf
    self._use_references(pdf, resources, images)
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/document.py", line 926, in _use_references
    pattern.extra['Resources'] = self._reference_resources(
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/document.py", line 896, in _reference_resources
    self._use_references(pdf, resources, images)
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/document.py", line 917, in _use_references
    x_object.extra['Resources'] = self._reference_resources(
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/document.py", line 896, in _reference_resources
    self._use_references(pdf, resources, images)
  File "/home/claus/.local/lib/python3.9/site-packages/weasyprint/document.py", line 912, in _use_references
    pdf.add_object(x_object.extra['SMask'])
  File "/home/claus/.local/lib/python3.9/site-packages/pydyf/__init__.py", line 451, in add_object
    object_.number = len(self.objects)
AttributeError: 'bytes' object has no attribute 'number'

@grewn0uille
Copy link
Member

For error 135, it’s a duplicate of #1431 and it’s fixed in 53.x. We’ll make a release soon!

And for the new error, can you please share your HTML/CSS files?

@slartibart70
Copy link
Author

anonymized.zip

sorry for anonymizing the text. my call is

weasyprint -v ${filename}.md.html ${filename}.md.pdf 

and this produces the above error

@liZe liZe closed this as completed in 3fd70e1 Sep 7, 2021
@grewn0uille grewn0uille added this to the 53.3 milestone Sep 7, 2021
liZe added a commit that referenced this issue Sep 7, 2021
@liZe
Copy link
Member

liZe commented Sep 7, 2021

Thanks a lot for this (double) bug report, it’s fixed in 53.x.

@slartibart70
Copy link
Author

very nice! thanks for the effort,
just checked out branch 53.x, my docs get converted perfectly (and acroboat is not complaining any more)
Time for a Douglas Adams quote: "I apologize for the inconvenience" :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants