Custom Page Size Scantailor

Share your software workflow. Write up your tips and tricks on how to scan, digitize, OCR, and bind ebooks.

Moderator: peterZ

Post Reply
HI3TEbfr4bUYdJ0OkYcx
Posts: 1
Joined: 29 Jul 2017, 10:49
E-book readers owned: Calibre
Number of books owned: 400
Country: Finland

Custom Page Size Scantailor

Post by HI3TEbfr4bUYdJ0OkYcx »

In Scantailor I sometimes want the final page size to match exactly A4. Especially for legal documents and letters. I use Linux Ubuntu.

My solution has been to produce PDF and split it into pages (pdftk document.pdf burst) and then combine them with Scribus. With Scribus it is also practical to add metadata into the document. Very laborous.

With Scantailor I insert one extra page into input images. It's size is exactly A4. The page can be produced with Scribus (export as image) but also from command line in the input directory.

Code: Select all

 gs \
 -o Zzz-temporary.pdf \
 -sDEVICE=pngmono \
 -dCompressPages=true \
 -sColorConversionStrategy=Gray \
 -sPAPERSIZE=a4\
 -c showpage

 convert -units pixelsperinch -monochrome Zzz-temporary.pdf -compress LZMA -density 300 Zzz-A4.tif
 rm Zzz-temporary.pdf
  • Zzz in the name sends the page to end.
  • Set the margins to zero for this page.
  • This A4 page must be bigger than any of the other pages with margins.
  • Maybe there is even easier ways to produce the page.
  • Available papersizes here.
  • Custom "-sPAPERSIZE=" is possible.
  • -dDEVICEWIDTHPOINTS=[width] plus -dDEVICEHEIGHTPOINTS=[height] is possible
  • Now all the final images in out-directory are all of the size A4.
  • Remove Zzz-A4.tif from the out-directory before proceeding.
Further thoughts.

Quite often the books page size happens to be near A4 standard. I mean the long edge is approximately square root 2 times the short. Short * sqr(2) = Long. Sometimes it might be a good idea to make the page edges to exactly match this sqr(2) ratio for printing purposes.

I think it is a piece of a cake to write a script to pick the biggest paper(short edge) from file.ScanTailor -file and multiply it by sqr(2). Then compare it to biggest paper(long edge). Whichever is bigger that defines the long edge. And short edge is long/sqr(2).

Then just make the empty page accordingly.
Post Reply