Merge Three Files into One Using Command Line
I have three pdf files that I want to merge into a single file. But I don’t want the three files to be on three separate pages. I want one big page with the three files all there.
First, get the sizes of my files:
$ identify PusherDisc32017.pdf PusherDisc32017.pdf PDF 1224x792 1224x792+0+0 16-bit sRGB 58413B 0.000u 0:00.000 $ identify PressBlockShort32017.pdf PressBlockShort32017.pdf PDF 1224x792 1224x792+0+0 16-bit sRGB 51523B 0.010u 0:00.000 $ identify LongPressBlock32117.pdf LongPressBlock32117.pdf PDF 1224x792 1224x792+0+0 16-bit sRGB 49860B 0.000u 0:00.000
So I want my final image to be 1224 x (3×792) or 1224 x 2376. Now make an empty image that size. I’m using a white background.
convert -size 1224x2376 canvas:white hold.png
Now, one at a time, merge the files together:
$ composite PusherDisc32017.pdf hold.png out1.png $ composite PressBlockShort32017.pdf -gravity center out1.png out2.png $ composite LongPressBlock32117.pdf -gravity south out2.png out3.png
Now my file out3.png has what I want.