mirror of
https://github.com/Llewellynvdm/pdflayers.git
synced 2024-11-24 20:57:34 +00:00
Use capitalised Root
Lower-case `root` is deprecated and doesn't work with newer versions of pikepdf.
This commit is contained in:
parent
16c2e58dfa
commit
85faf76442
@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
|
|||||||
def set_layer_visibility(pdf, layers_to_show):
|
def set_layer_visibility(pdf, layers_to_show):
|
||||||
"""Set visibility of layers."""
|
"""Set visibility of layers."""
|
||||||
try:
|
try:
|
||||||
ocgs = pdf.root.OCProperties.OCGs
|
ocgs = pdf.Root.OCProperties.OCGs
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
logger.error("Unable to locate layers in PDF.")
|
logger.error("Unable to locate layers in PDF.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -29,7 +29,7 @@ def set_layer_visibility(pdf, layers_to_show):
|
|||||||
Order=ocgs,
|
Order=ocgs,
|
||||||
)
|
)
|
||||||
|
|
||||||
pdf.root.OCProperties = pikepdf.Dictionary(
|
pdf.Root.OCProperties = pikepdf.Dictionary(
|
||||||
D=ocgs_config,
|
D=ocgs_config,
|
||||||
OCGs=ocgs,
|
OCGs=ocgs,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user