baruchel / txt2pdf

Text to PDF converter with Unicode support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ENHANCEMENT idea page start/end/offset parameter support

clach04 opened this issue · comments

Neat option(s) would be to take in parameters for:

  • end - stop emitting PDF pages after end number of pages have been produced
  • start/offset - do not start emitting PDF pages until processed start number of pages have been processed.

e.g.

python txt2pdf.py --media letter --start 10 --end 20 myfile.txt

only output the pages 10 through to and including 20 to the output PDF file.

Alternative (possibly follow on feature) would be a pages parameter which could take ranges, e.g.:

  • --pages "10-20" same as above demo
  • --pages "1,3,5,7,9" all the odd numbered pages below 10
  • --pages "1,2, 3,10-20" - pages 1, 2, and 3 and then the range 10-20
  • --pages "10-20, 99-102" - range 10-20 and 99-102

I've not had time to implement this, as a quick workaround I'm generating the entire PDF (which for 3000 pages is pretty quick, a few secs) and then extracting the desired pages using another tool (hand written using PyPDF2), for example pdftk.