Created
March 5, 2019 22:04
-
-
Save jacobkahn/d997a0bffa419beb55a655bf2dd133af to your computer and use it in GitHub Desktop.
CIS 320 Exam Parser
This file contains 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
import uuid | |
from pyPdf import PdfFileWriter, PdfFileReader | |
for qq in range(1, 10): | |
inputpdf = PdfFileReader(open("in" + str(qq) + ".pdf", "rb")) | |
j = -1 | |
for i in xrange(inputpdf.numPages): | |
print(i) | |
if i % 10 == 0: | |
j += 1 | |
if i > 0: | |
with open(str(uuid.uuid4()) + ".pdf", "wb") as outputStream: | |
output.write(outputStream) | |
output = PdfFileWriter() | |
output.addPage(inputpdf.getPage(i)) | |
j += 1 | |
with open(str(uuid.uuid4()) + ".pdf", "wb") as outputStream: | |
output.write(outputStream) | |
qq += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment