Skip to content

Commit

Permalink
adopt fix for issue #22
Browse files Browse the repository at this point in the history
See #22
  • Loading branch information
Xunius committed Oct 4, 2019
1 parent e22a34c commit c343dc3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/exportpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,23 @@ def exportPdf(fin,outdir,annotations,verbose):

outpdf.addPage(inpg)


# this is a fix provided by rongmu regarding issue #22:
# https://github.com/Xunius/Menotexport/issues/22
# As I'm not giving it tests I'll put it inside a try

# fix start ----------------------------------{{{
# Copy the root (document catalog) except for /Pages
# PDF Reference, Sixth Edition, version 1.7, p.137
# https://www.adobe.com/devnet/pdf/pdf_reference_archive.html
try:
for k,v in inpdf.trailer["/Root"].items():
if k.getObject() != "/Pages":
outpdf._root_object.update({k: v})
except:
pass
# fix end ----------------------------------}}}

#-----------------------Save-----------------------
filename=annotations.filename
if not os.path.isdir(outdir):
Expand Down

0 comments on commit c343dc3

Please sign in to comment.