0

I have a two-sided, us-letter format document that I'd like to print two copies at once, by resizing it to half letter (a.k.a. statement, or organizer L).

My current workflow is very inconvenient:

  • The original document is two-sided, A, B, C, etc.
  • Using PDFSam's mix-pdf, duplicate each page (so that the document is A, A, B, B, C, C, …),
  • Using pdfjam, resize the document and have two pages by page (so that I have A A on the same page, on landscape mode, one of top of the other, etc.),
  • Print using lp -o sides=two-sided-long-edge.

I am sure there is a simpler way to achieve this, but couldn't find it. An additional hurdle of my current way of doing is that pdfjam introduces extra margin, that I have to remove using trim.

1 Answer 1

1

What works for me is using pdftk to double up the pages, which you can then pair using pdfjam:

pdftk Lorem.pdf cat 1 1 2 2 output - |
    pdfjam --nup 2x1 --landscape --outfile Lorem_2up.pdf

You can use /dev/stdout instead of Lorem_2up.pdf to pipe the result to stdout for further processing (or printing).

If you want to generalise the solution you need to identify the number of pages and then generate an appropriate double-up command:

#!/bin/bash
file=$1
pages=$(pdftk "$file" dump_data | awk '/NumberOfPages/ {print $2}')

cats=()
for ((page=1; page<=pages; page++))
do
    cats+=($page $page)
done

pdftk "$file" cat "${cats[@]}" output - |
    pdfjam --nup 2x1 --landscape --outfile "${file%.pdf}_2up.pdf"

Reference

2
  • That's brilliant! I'll try to automate the cat 1 1 2 2 output to accommodate any size of document and post it as an answer, but your idea of using the cat command is precious!
    – Clément
    Commented Nov 25, 2023 at 18:48
  • @Clément if you'd said you'd wanted a generalised solution I'd have written one, but your question stated it was for PDFs of only two pages. I've added a more general solution for you Commented Nov 26, 2023 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .