Skip to content

pdf to image rendering ignore optional content offs #3806

@PasaOpasen

Description

@PasaOpasen

Description of the bug

with some docs with already disabled optional content layers the rendered pages still contain them;

example link: https://dropmefiles.com/zTbp4

How to reproduce the bug

f = 'path/oc-for-ocr.pdf'
dpi = 150

import fitz
from PIL import Image

doc = fitz.open(f)
print(doc.layer_ui_configs())  # shows that almost all layers except "Text" are off

pix = doc[0].get_pixmap(matrix=fitz.Matrix(dpi/72, dpi/72))
img =Image.frombytes('RGB', (pix.width, pix.height), pix.samples)

img.show()  # displays image containing all layers info

PyMuPDF version

1.24.9

Operating system

Windows

Python version

3.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions