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).
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.
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).