qpdf icon indicating copy to clipboard operation
qpdf copied to clipboard

Reconstructing a two sided paper from one sided scans

Open heikkiorsila opened this issue 2 years ago • 3 comments

I had a stack of two sided A4 papers that I wanted to scan with a scanner that can only scan one sided papers. I first scanned odd pages front to back as odd_pages.pdf, and then even pages back to front as even_pages.pdf.

[ Note: I did not scan even pages front to back because then I would have to reverse the order of the papers in the stack manually. ]

So I created this script to process odd_pages.pdf and even_pages.pdf into a linear page output:

https://gitlab.com/heikkiorsila/pdf_2_side_reconstruction

Is there a simpler way to do all this with qpdf?

heikkiorsila avatar Mar 10 '23 10:03 heikkiorsila

Basically, the script is short-hand for running two qpdf commands:

$ python3 main.py odd_pages.pdf even_pages.pdf -o output.pdf
Running: ['qpdf', 'even_pages.pdf', '--pages', 'odd_pages.pdf', '1-z', 'even_pages.pdf', '1-z', '--', '/tmp/tmpwp7b3i5y.pdf']
Running: ['qpdf', '/tmp/tmpwp7b3i5y.pdf', '--pages', '/tmp/tmpwp7b3i5y.pdf', '1,104,2,103,3,102,4,101,5,100,6,99,7,98,8,97,9,96,10,95,11,94,12,93,13,92,14,91,15,90,16,89,17,88,18,87,19,86,20,85,21,84,22,83,23,82,24,81,25,80,26,79,27,78,28,77,29,76,30,75,31,74,32,73,33,72,34,71,35,70,36,69,37,68,38,67,39,66,40,65,41,64,42,63,43,62,44,61,45,60,46,59,47,58,48,57,49,56,50,55,51,54,52,53', '--', 'output.pdf']

Yes, I know it's not pretty.

heikkiorsila avatar Mar 10 '23 10:03 heikkiorsila

At this time, there isn't anything that does this, but I am working on a feature that will make this kind of operation possible. I don't know exactly what the command will look like. I'm putting the pages label on this issue so I can make sure this use case will be included.

jberkenbilt avatar Mar 10 '23 13:03 jberkenbilt

This issue is part of the qpdf pages epic. If you are interested in following, please see #1104.

jberkenbilt avatar Jan 04 '24 18:01 jberkenbilt