1
0
mirror of https://github.com/Llewellynvdm/pdflayers.git synced 2024-11-21 11:25:09 +00:00

Use capitalised Root

Lower-case `root` is deprecated and doesn't work with newer versions of pikepdf.
This commit is contained in:
mara004 2021-11-27 11:59:09 +01:00 committed by GitHub
parent 16c2e58dfa
commit 85faf76442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
def set_layer_visibility(pdf, layers_to_show):
"""Set visibility of layers."""
try:
ocgs = pdf.root.OCProperties.OCGs
ocgs = pdf.Root.OCProperties.OCGs
except (AttributeError, KeyError):
logger.error("Unable to locate layers in PDF.")
sys.exit(1)
@ -29,7 +29,7 @@ def set_layer_visibility(pdf, layers_to_show):
Order=ocgs,
)
pdf.root.OCProperties = pikepdf.Dictionary(
pdf.Root.OCProperties = pikepdf.Dictionary(
D=ocgs_config,
OCGs=ocgs,
)