IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 34c165e8 authored by Ralf Ulrich's avatar Ralf Ulrich
Browse files

Update README.md

parent 83ed275e
No related branches found
No related tags found
No related merge requests found
# Introduction, Context
If PDF files are edited with inkscape, or generated with matplotlib, it is a
typical scenario that PageGroups are part of those files. If multiple such
PDFs are included, e.g. in latex. Only one of those PageGroups is used (there
can only be one at least per page). It is not clear if this is a misbehaviour
can only be one at least per page). It is not very clear to me if this is a misbehaviour
of inkscape, latex or just a general problem in working with both of them.
Latex will produce warnings/errors in such cases pointing to the PageGroups.
However, latex will produce warnings/errors in such cases pointing to the PageGroups.
With this script here, PDF files can be edited automatically to remove
PageGroups. The internal structure of the PDFs is kept consistent, if needed
the xref tables are updated and fixed.
the xref tables are updated and fixed. The quality of the PDF is not affected.
Also the size of the files is not affected (they become a few bytes shorter).
Use this tool with great care, do not trust its output blindly. Make sure the
generated files are completely OK for the purpose they are indendet for.
This tool helped me to write and review papers for the CMS Collaboration
where no errors on latex are allowed in the final step.
# Warning
**Use this tool with great care, do not trust its output blindly**.
Make sure image-by-image that the
generated files are completely OK for the purpose they are indended for!
I tested this on files editor with inkscape and generated by matplotlib with
excellent results. Thus a workflow for files, where the normal application of
the script does not result in good results, it is worth trying to first import
in inkscape, re-export as pdf, the apply this script, check output.
This tool helped me to write and review papers for the CMS Collaboration
where no errors on latex are allowed in the final step.
Note, this only works on single-page PDFs! It is only intended for individual
plots/images.
# Usage
`./strip_pdf.py <file.pdf>`
The script will check if file.pdf has any PageGroups and only if one is found
it will create a security copy `file.save.pdf` and modify the original file
to remove the PageGroup.
Ralf Ulrich
May 2020
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment