1
0
mirror of https://github.com/Llewellynvdm/pdflayers.git synced 2024-12-18 23:12:00 +00:00

Merge pull request #6 from SimonSegerblomRex/doc-cleanup

Cleanup of comments
This commit is contained in:
Simon Segerblom Rex 2019-05-16 22:56:45 +02:00 committed by GitHub
commit a389c34b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,16 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Script for editing PDF to change layer (OCG) visibility. """Script for editing PDF to change layer (OCG) visibility.
The output should display correctly in the PDF viwer in google-chrome, The output should display correctly in google-chrome,
evince, okular, and Adobe Reader (with JavaScript disabled). evince, okular, and Adobe Reader (with JavaScript disabled).
pdf.js in firefox might not work: https://github.com/mozilla/pdf.js/issues/4841 pdf.js in firefox might not work: https://github.com/mozilla/pdf.js/issues/4841
Requirements:
Install pikepdf:
pip3 install --user pikepdf
and run the script with python3.
References: References:
https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdf_reference_archive/PDFReference16.pdf https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdf_reference_archive/PDFReference16.pdf
https://pikepdf.readthedocs.io/ https://pikepdf.readthedocs.io/
@ -49,7 +44,7 @@ def set_layer_visibility(pdf, layers_to_show):
OCGs=ocgs, OCGs=ocgs,
) )
# Needed for the PDF viwer in google-chrome (at least): # Needed for google-chrome (at least):
for ocg in ocgs: for ocg in ocgs:
if '/View' in ocg.Usage: if '/View' in ocg.Usage:
del ocg.Usage.View del ocg.Usage.View