diff options
author | ben | 2018-09-18 10:52:38 +0200 |
---|---|---|
committer | ben | 2018-09-18 10:52:38 +0200 |
commit | f57654b84b4cf0ffa1287034fc9f66ba200bb259 (patch) | |
tree | 5ffb371ce5b5008052e425955f45c8b808ba7fa0 /tests/test_pdf_normalisation.py | |
download | truepolyglot-f57654b84b4cf0ffa1287034fc9f66ba200bb259.tar.gz truepolyglot-f57654b84b4cf0ffa1287034fc9f66ba200bb259.tar.bz2 truepolyglot-f57654b84b4cf0ffa1287034fc9f66ba200bb259.tar.xz |
First public commit
Diffstat (limited to 'tests/test_pdf_normalisation.py')
-rwxr-xr-x | tests/test_pdf_normalisation.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_pdf_normalisation.py b/tests/test_pdf_normalisation.py new file mode 100755 index 0000000..aba197e --- /dev/null +++ b/tests/test_pdf_normalisation.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import sys +sys.path.append("../") +import logging +from PdfFileTransformer.PyPDF2 import PdfFileReader, PdfFileWriter + + +input_file = "./samples/test1.pdf" +output_file = "./samples/test1_out.pdf" + +logging.basicConfig(level=logging.DEBUG) + +f_input = open(input_file, "rb") +reader = PdfFileReader(f_input) + +f_output = open(output_file, "wb") +writer = PdfFileWriter() + +writer.appendPagesFromReader(reader) +writer.setHeader(b"%PDF-1.5") +writer.write(f_output) + +f_input.close() +f_output.close() |