Monday, 15 September 2014

python - PyPDF2, Set PDF version -


I am using PyPDF2 1.4 and Python 2.7:

How can I change the PDF version Any input file for any output file?

InputPDF.documentInfo (inputPDF.numPages) for information = I: # output output output output = PDF outputPDF = PdfFileWriter () # output pdf infoDict = outputPDF._info.getObject () #Update output for PDF Metadata with PDF Metadata: infoDict.update ({NameObject (key): createStringObject (info [key])} outputPDF.addPage (inp) OutputStream: outputPDF.write (outputstream) as utPDF.getPage (i)) with Open (output_filename, 'WB)

PyPDF2 S No PDF can generate anything but the .3 header in its current version; From: Category PdfFileWriter (object):

  "" This class supports PDF files, looking at pages written by other classes, given (.: Category: Generally, PdfFileReader & Gt; `PdfFileReader & lt`) "" "Def __init __ (self): self._header = b _ ("% PDF-1.3 ") ...  

If it is < Em> legal , the reason for this is that it gives you> 1.3 The ability to feed in things is suspicious.

If you only want to fix the version string in the header (I do not know which will be the result, so I think you have more information about it compared to PDF standard Am!)

  PyPDF2.utils import b_ ... from outputPDF._header.replace (b _ ("PDF-1.3"), b _ ("PDF-1.5"))  

or something like that.


No comments:

Post a Comment