Skip to content

convert_to_pdf() - FzErrorFormat: code=7: truncated jbig2 segment header  #3553

@spreeni

Description

@spreeni

Description of the bug

I want to extract a subset of pages of the document as a PDF, but I get the following error:

pymupdf.mupdf.FzErrorFormat: code=7: truncated jbig2 segment header

I can open the Pdf file normally in other programs and could finally solve it in pypdf.

How to reproduce the bug

doc = Document(file)
page_no = 4
page_bytes = doc.convert_to_pdf(from_page=page_no - 1, to_page=page_no)

I legally can't upload the pdf files I have been testing with, I will see if I can reproduce it on a public domain file. But maybe someone already understands the error message above.

In the end, I now solved it by switching to pypdf, creating a new pdf with the PdfWriter. But I generally like PyMuPDF, so I thought I'd submit it here as an issue.

PyMuPDF version

1.24.4

Operating system

MacOS

Python version

3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    not a bugnot a bug / user error / unable to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions