I'm looking for a ghostscript (or other commandline) command to reimpose a pdf page so that the elements on the left side are copied to the right. Like so:
The size of the page shouldn't change (each page is cropped and cut differently), and while I could supply the final size manually, it would be neater to read it from the original pdf.
For the sake of simplicity, let's assume that the input file has only one page.
I've come up with an extremely complicated series of commands, involving
- reading the CropBox with
pdfinfo
- copying the file and changing the cropbox so that the left half is shortened and the right half is extended with the
-c "[/CropBox [*new dimensions*] /PAGES pdfmark"
command - copying the file and changing the cropbox so that the left half remains
- reprocessing this file with the old page dimensions
-g "PageDimension"
and-c \"<<\/Install{1 1 scale WithOfRightside 0 translate}>> setpagedevice\"
- use pdftk to merge the two new files into one page:
pdftk.exe lefthalf.pdf background righthalf.pdf output combinedfile.pdf
I couldn't get this to work satisfactorily, however, and I don't like either the series of steps involved or the number of tools invovled. Surely all the steps could be performed with ghostscript and in fewer steps (and less reprocessing of the original).