modified: PyPDF2/pagerange.py
Define "Str" (capital S) to mean basestring in 2.x, str in 3.x.
Used while validating a PageRange initializer.
modified: Sample_Code/makesimple.py
from __future__ import print_function
I guess this would work, except makesimple.py uses reportlab, which
isn't 3.x compatible yet.
modified: Sample_Code/pdfcat
from __future__ import print_function
Aargh! PdfFileMerger in 3.x requires that the input files stay
open while it's doing the write(). So, I went back to caching all
the open files in pdfcat. I do not close them, since pdfcat is just
a script and exits immediately. But at least each file is only open
with one file object.
Tested in 2.7 and 3.3. Redirecting stdout works in both on Mac OS X.
modified: LICENSE
Added Steve Witham <switham_github@mac-guyver.com>
modified: PyPDF2/pagerange.py
Fixed some error handling.
Made parse_filename_page_ranges return a list instead of being a generator.
Tweaked a variable name for readability.
renamed: Sample_Code/makepages.py -> Sample_Code/makesimple.py
also modified:
Renamed the code to be similar to makesimple.sh.
Changed the output file names to be the same as makesimple.sh makes.
modified: Sample_Code/pdfcat
Fixed to allow sending output to a file by redirection like with cat,
pdfcat input*.pdf >output.pdf
using
output = os.fdopen(stdout.fileno(), "wb")
I have not tested this in Windows, but the Python docs say the calls are
supported in Windows. The worst problem this could cause would be to
silence PyPDF2's existing warning about the file being in text mode,
while still actually writing in Windows text mode.
Added examples to the --help output to show output-redirect style.
Took out the caching of open input files. Needless complication.
Added a try...except so that if there's a problem while processing an
input file, print the filename.
Made quiet the default and --verbose an option.