1

I've been trying to print a booklet for some non-standard page sizes, and cannot figure out how to get pdfbook to not scale to standard page size.

All I want to do is just double the width of the pdf file instead of scaling to a paper size.

What I've done this time is

  1. Opened pdf file and opened properties
  2. [I found 100x100mm in the pdf properties, so] I then executed pdfbook --papersize '{100mm,200mm}' input.pdf

Is there an automatic way of achieving this?

5
  • It's about TeX that you are talking about right? Meybe you should ask in TeX - LaTeX.
    – Braiam
    Jul 24, 2013 at 5:50
  • I don't understand your requirements. Do you want one logical page per PDF page or two? Do you want the PDF size to be the same for the output as for the input or twice the size? Do you want the text to be stretched horizontally, kept to the same absolute size, or kept to the same size relative to the page? Jul 24, 2013 at 20:47
  • @Braiam It's implemented in TeX, but specifically, the step 2 (being a command) is not TeX but standard shell.
    – Stephen
    Jul 31, 2013 at 2:24
  • @Gilles The workaround steps in the question take a square pdf and exactly double the width to create an exactly double size booklet, instead of one that is scaled to a certain (e.g. A4) page size. The key word in the question is "automatic": the steps produce the correct result, but require manual effort for each conversion (of different size pdfs)
    – Stephen
    Jul 31, 2013 at 2:26
  • @Stephen Ah, so the problem is to extract the dimensions from the properties automatically? If so I recommend editing the title and the opening paragraph of your question as well, they make it look like your problem is running pdfbook whereas if I understand correctly now a way to solve your problem is to find the right numbers to pass as argument to --papersize for pdfbook. Jul 31, 2013 at 7:47

1 Answer 1

0

There's probably a way to solve this by writing a custom TeX driver instead of the one pdfbook uses.

Alternatively, you can use some other tool to extract the PDF dimensions, such as [pdfinfo] from the poppler utilities (poppler-utils package on Debian/Ubuntu).

dimensions=$(pdfinfo -box input.pdf |
             awk '$1 == "MediaBox:" {print "{" ($5-$3) "pt," (2*($4-$2)) "pt}" }')
pdfbook --papersize "$dimensions" input.pdf
3
  • Awesome - Thanks! I corrected the off-by-one errors ($1 refers to MediaBox: - at least it did for me... Looking at pdfinfo, I'm interested why you chose MediaBox instead of Page size...
    – Stephen
    Jul 31, 2013 at 22:04
  • @Stephen Oops, pesky awk starting at 1. I chose MediaBox because it looks more consistently parseable. Jul 31, 2013 at 22:08
  • Updated again since pdfbook has dimension args in the opposite order...
    – Stephen
    Jul 31, 2013 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.