Skip to content

[Bug] Linearization crashes with doc.write() method #674

Closed
@zufj

Description

@zufj

Describe the bug

When attempting to apply the linearization to a document while use the write()method generates the error "RuntimeError: cannot seek in buffer: No such file or directory". This does not happen when using the save() method.

To Reproduce

import fitz
doc = fitz.open(pdf_path)
# Works:
doc.save("linearized.pdf",garbage=0, deflate=False,linear=True)
# Returns error: "RuntimeError: cannot seek in buffer: No such file or directory"
linearized_pdf_bytes = doc.write(garbage=0, deflate=False,linear=True)

Expected behavior

The method should return the bytes of the linearized PDF data.

Your configuration (mandatory)

  • Ubuntu 20.04
  • Python 3.8.5
  • PyMuPDF 1.17.7 installed through pip

3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0]

PyMuPDF 1.17.7: Python bindings for the MuPDF 1.17.0 library.
Version date: 2020-09-14 06:33:06.
Built for Python 3.8 on Liinux (64-bit).

Metadata

Metadata

Assignees

Labels

bugwontfixno intention to resolve

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions