Skip to content

How do I remove layers or copy a layer to a new file? #4757

@p-vdp

Description

@p-vdp

I'm new to this package, and I've figured out how to toggle layers on/off:

import pymupdfd
doc = pymupdf.open("file.pdf")
ogcs = doc.get_ocgs()
lyr_xref = ogcs[0]
doc.set_layer(-1, on=[lyr_xref], basestate="OFF")  # turn off all but the first layer

But how do I delete them, or copy a specific layer to a new file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions