Commit Graph

31 Commits

Author SHA1 Message Date
Michał Łuszczyk 8ba44f2099 Fix PdfFileMerger for file objects on Python 3.
The previous check was always evaluated to False on Python 3, so I replaced it
with a duck-typing one compatible with both Python versions.
2016-10-21 21:35:39 +02:00
Todd Wolfson 541963c54b Added decryption key copying for PdfFileMerger 2015-06-26 14:09:12 -05:00
Brent Amrhein 94952e48b2 utils.py changes
----------------
 - Adding functions isString(), isInt(), isBytes() to make type testing simpler and more consistent. Works for Python 2 and 3.
   - Note: "string_type", "bytes_type" and "int_types" are functionally unchanged: Made sure all references to these types were compatible with how things worked pre-fork.
2015-02-13 16:21:36 -05:00
Matthew Stamy 386d67ed92 Fixed encoding issue in merger (with eshellman) closes #135, closes #136 2014-12-31 14:37:47 -06:00
Ernesto Revilla 164707a64b PEP8 fixes: mixed tabs / spaces, blank lines. 2014-11-26 22:43:35 +01:00
"Jason Scheirer" 797320300b Update docstring in merger.py for setPageMode() 2014-07-01 10:11:30 -07:00
Matthew Stamy fbae7c54f0 Merge branch 'master' of git://github.com/mstamy2/PyPDF2 2014-06-30 15:49:15 -05:00
Matthew Stamy 101b549bb8 Documentation Overhaul 2014-06-30 15:47:57 -05:00
shilluc 7470a3e3e6 Fix typos in OutlinesObject().add() 2014-06-30 14:35:17 +02:00
sdpython b1fa236294 change StringIO into BytesIO for Python 3 2014-03-14 11:57:28 +01:00
Matthew Stamy f3c9dc5856 Make use of string_type 2014-02-20 17:22:54 -06:00
Jamie Lentin fabb6506e3 Bookmarks entry is either array of sub-items, or bookmark hash. Not both. 2014-01-17 21:36:34 +00:00
switham 0430929766 pdfcat, pagerange seem to work, semi-integrated. 2014-01-08 18:24:29 -05:00
Matthew Stamy 4d0d0117f2 Allow use of PdfFileMerger (credit to cgammans) 2013-12-31 14:26:10 -06:00
TWAC b44f0a0cc1 make extractText work in Python 2.7 and 3.3 2013-12-13 13:01:43 +01:00
Matthew Stamy 793be4355b Python 3 Syntax changes 2013-12-11 16:07:51 -06:00
Matthew Stamy 416eac9dbc Return bookmark so nested bookmarks can be created. 2013-11-20 16:39:05 -06:00
Matthew Stamy 38a8c3a0ee Corrected minor typos, made sure all new methods were available in PdfFileMerger AND PdfFileWriter/Reader 2013-10-01 17:04:32 -05:00
Matthew Stamy e802a0d84a Implementation of methods to customize Metadata (based off of the work of jamma313) 2013-09-30 17:02:43 -05:00
Matthew Stamy 2f09103b7b Merge branch 'add-infos-pull' of https://github.com/jamma313/PyPDF2 into jamma313-add-infos-pull 2013-09-24 17:16:10 -05:00
Matthew Stamy 833900060d Removed old test code,
added a couple warnings/exceptions,
closes #27,
added debug method to utilities,
added and corrected some documentation
2013-09-19 17:01:15 -05:00
Matthew Stamy 7f8846d7e2 Merge branch 'bookmark-dest' of https://github.com/jamma313/PyPDF2 into jamma313-bookmark-dest 2013-08-12 15:37:04 -05:00
Pierre-Alain Mignot 2e5dabacd6 be sure to avoid null object value 2013-07-16 19:49:31 +02:00
Pierre-Alain Mignot 6f5a7d5bcb Adding possibility to include metadata (Title, Author, Keywords, Subject, Creator, Producer) to merged PDF 2013-06-30 19:20:08 +02:00
Pierre-Alain Mignot 18be20f80f respect destination syntax of table 8.2 in PDF 1.6 specs + support multi-level bookmarks 2013-06-30 18:58:01 +02:00
Janne Vanhala 4ffc53f76d Removed duplicate `Destination` class
I was experimenting with `PdfFileMerger` and when I tried to
write the data to a file the following exception was raised:

    Traceback (most recent call last):
      File "pypdf2/PyPDF2/merger.py", line 194, in write
        self._write_bookmarks()
      File "pypdf2/PyPDF2/merger.py", line 280, in _write_bookmarks
        self._write_bookmarks(b, last_added)
      File "pypdf2/PyPDF2/merger.py", line 292, in _write_bookmarks
        last_added = self.output.addBookmarkDestination(b, parent)
      File "pypdf2/PyPDF2/pdf.py", line 442, in addBookmarkDestination
        parent.addChild(destRef, self)
    AttributeError: 'Destination' object has no attribute 'addChild'

After debugging this for a while I noticed that there are two
different `Destination` classes in PyPDF2 defined in the following
modules: `PyPDF2.generic` and `PyPDF2.pdf`. The difference between
them is that the one defined in `generic` module inherits from
`TreeObject` and has a few extra methods (`getDestArray` and
`writeToStream`)  whereas the one defined in `pdf` modules inherits
from `DictionaryObject`.

The `addBookmarkDestination` method expects that `parent` has
`addChild` method, which in turn is defined in `TreeObject` class.
Thus, in order to fix this issue, I removed `Destination` class
defined in `PyPDF2.pdf` module.
2013-06-14 10:53:12 +03:00
Noah Kessler 9cd94b6449 Modified merger.py so that files can be closed after they are appended/merged to a PdfFileMerger object and before the merged PDF is written out. This is accomplished by creating a StringIO stream of the content of the file and using that as the source for the merge. The same is done with PdfFileReader objects that are to be merged/appended; the stream is wrapped into a separate StringIO object. 2012-12-29 16:12:42 -06:00
Noah Kessler 1e352334c7 Added support for new strict/relaxed version of PdfFileReader; defaults to strict. 2012-03-13 16:06:56 -05:00
Noah Kessler 7a25ab6906 Reverted to calling PdfFileWriter.getReference() since it has been re-implemented in pdf.py 2012-01-31 22:07:39 -06:00
Noah Kessler 80ff51ae67 Added a workaround to avoid reference to obsolete method getReference() in PdfFileWriter 2012-01-11 17:03:32 -06:00
Adam Coleman c59a212a4c First commit
Original PyPDF code. Updates should be coming from Noah soon.
2011-12-30 09:04:56 -06:00