mfenniak / pyPdf

Pure-Python PDF Library; this repository is no longer maintained, please see https://github.com/knowah/PyPDF2/ insead.
https://github.com/knowah/PyPDF2/
Other
276 stars 85 forks source link

Merge page improved and bug fixes. #34

Open Averell7 opened 12 years ago

Averell7 commented 12 years ago

1) get_data (line 1555) has a bug. With the present code, the end of line is not written in some cases where it should, and this conducts to the merging of two lines and invalid code. With the correction suggested, there are some useless end of lines added, but this is not a problem in a pdf file.

2) createBlankPage : although /Contents is not required there are programs which will return an error when they encounter a page without this resource. Adding an empty /Contents does no harm and prevents these problems.

3) mergeResources presently ignores Xobjects which leads to serious problems when merging pages.

4) mergePage3 and the related functions (setContent, extractContent and _addCode) allows a much faster merging by reducing to the minimum the calls to parseContentStream. To see it in action, try pdf-Booklet 2.0 present on SourceForge. The speed improvment may be between 4x and 200x, depending of the situation. The average speed improvment is 50x (50 times faster).

Averell7 commented 12 years ago

Since I am not really comfortable with object oriented programming, my code may be enhanced. But as is, it works for more than one year now, without known problems.