![]() Raise TypeError('"pages" must be a tuple of (start, stop)')īookmark = Bookmark(TextStringObject(bookmark), NumberObject(self.id_count), NameObject('/Fit')) Pages = pages.indices(pdfr.getNumPages()) ![]() Pdfr = NewPdfFileReader(fileobj, strict=self.strict) # (either file or BytesIO or StringIO) created above # Create a new PdfFileReader instance using the stream # If fileobj is none of the above types, it is not modifiedįilecontent = StreamIO(())į(orig_tell) # reset the stream to its original location # it is a PdfFileReader, copy that reader's stream into a # copy the file's contents into a BytesIO (or StreamIO) stream object if # and create a file object at that location. # If the fileobj parameter is a string, assume it is a path # that the stream used was created in this method. :param bool import_bookmarks: You may prevent the source document's bookmarksįrom being imported by specifying this as ``False``. To merge only the specified range of pages from the source :param pages: can be a :ref:`Page Range ` or a ``(start, stop)`` tuple The beginning of the included file by supplying the text of the bookmark. ![]() :param str bookmark: Optionally, you may specify a bookmark to be applied at String representing a path to a PDF file. :param fileobj: A File Object or an object that supports the standard readĪnd seek methods similar to a File Object. :param int position: The *page number* to insert this file. Merges the pages from the given file into the output file at the NewPdfFileReader._buildOutline = _newBuildOutlineĭef newMerge(self, position, fileobj, bookmark=None, pages=None, import_bookmarks=True): Raise utils.PdfReadError("Unexpected destination %r" % dest) Outline = self._buildDestination(title, dest)Įlif isString(dest) and dest in self._namedDests: # if destination found, then create outline # Action, section 8.5 (only type GoTo supported)Įlif "/Dest" in node and "/Title" in node: The file: from PyPDF2 import PdfFileReader, PdfFileMergerįrom PyPDF2.pdf import ArrayObject, NameObject I implemented it into a separate file that I import like so: from _pypdf2_fix import NewPdfFileReader as PdfFileReader, NewPdfFileMerger as PdfFileMerger If the method mentions doesn't work for you, try the method mentions on GitHub.
0 Comments
Leave a Reply. |