jenom / pdfbook2

Create booklets from PDF files
GNU General Public License v3.0
60 stars 13 forks source link

Updated TeXLive 2024.0 creates bogus output sizes #25

Open alerque opened 6 months ago

alerque commented 6 months ago

I've been using this for years in scripts to create booklets. I recently upgraded to TeXLive 2042.0 and now the --paper= option seems to have no effect. My projects are mostly a4paper but now this app is always outputting letterpaper no matter what is specified. The input documents haven't changed nor have the calling args, but the output is now the wrong geometry.

alerque commented 6 months ago

So I'm not 100% sure, but it seems like this might be an issue with pdfjam. In any case behind the scenes this script uses pdfjam with is now unmaintained (see here which is going to mean things only get worse from here.

Because I urgently needed my workflows back online, I jump ship and got things rolling with a combination of psutils and cpdf. The psbook command re-orders pages for signatures, and psnup combines them into pages. Between the two of these you get what pdfbook2 does. The only difference is I couldn't figure out how to set the default page view to be landscape, so I used cpdf to rotate the vew.

# original
pdfbook2 --short-edge --no-crop --paper=a4paper -- file.pdf
cp file-book.pdf file.pdf

# refactored
psbook file.pdf /dev/stdout |
    psnup --paper a4 -2 /dev/stdin file-book.pdf
cpdf -rotate 90 file-book.pdf -o file.pdf

The use of dev device filename seems more stable than the documented - STDIN/STDOUT, and since I wanted in-place handling anyway I just used pdfbook2's default output of -book as an intermediate file. Your use case(s) may vary, but hopefully somebody finds this useful.

krumelmonster commented 6 months ago

I hit this when I needed pdfbook2 today

Shameless self-advertisement: I'm now creating https://codeberg.org/krumelmonster/pdffold for all my booklet needs

alerque commented 6 months ago

Why re-invent the wheel that psutils clearly already covers and in the same language even? What deficiency or use case are you trying to address?

krumelmonster commented 6 months ago

I was looking at your solution earlier and I'm sure it's great but I couldn't find cpdf, my distribution (arch) does not provide it so I decided I'd continue on an older project.

I have a different version of this that supports placing more than two pages on a sheet as well as adding cutmarks, I want to merge this functionality into pdffold, then add a gui. I have a friend in bookbinding who tells me all this is direly needed.

Also I find pymupdf interesting and there's no shaming in programming something even if something similar already exists.