-
-
Save petrbel/48c5d5cdb709876b4b23fcf3449700f7 to your computer and use it in GitHub Desktop.
Last frontier destroyed, submitting thesis.pdf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment