Skip to content

Commit

Permalink
Python script from T.Hromada for fixing PDF/A
Browse files Browse the repository at this point in the history
  • Loading branch information
svecon committed May 15, 2017
1 parent 21e619f commit 01dab14
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pdf_interpolate_false.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pdfrw import PdfReader, PdfWriter, PdfObject


def main():
thesis = PdfReader('thesis.pdf')

for i, _ in enumerate(thesis.pages):
try:
im_keys = thesis.pages[i].Resources.XObject.keys()

for key in im_keys:
thesis.pages[i].Resources.XObject[key].Interpolate = PdfObject('false')
thesis.pages[i].Resources.XObject[key].SMask.Interpolate = PdfObject('false')

except:
print('This page does not have images: {}'.format(i))

PdfWriter().write('thesis_out.pdf', thesis)


if __name__ == '__main__':
main()

0 comments on commit 01dab14

Please sign in to comment.