command line - Imagick Convert Append 2 pdf pages
2013-09
I am using the following code to make a single pdf file with multiple pages in one jpg file I am using Imagick library and PHP tcpdf
convert -append path1.pdf path2.jpg
Now what i need to do is to add a white space between each page to differentiate them from one another, or add text in between like Page 1, Page 2. Currently they come correct. But there is no space in between.
Can anyone help me out
i have been using the commands up.
but after some research found the following code working correctly
convert -append -bordercolor White -border 20x20 path1.pdf path2.jpg
this adds a border on each side and a separate one on each PDF page then appends the images up and down.
If I've understood your question correctly, you want to convert a multi-page pdf
file into a single .jpg
file and separate each page of the .pdf
with whitespace. One way to do this is to split the .pdf
into one file per page and then join the pages specifying a border between them:
Split the pdf into many jpgs. This command will create fioles called
foo_0001.jpg
,foo_0002.jpg
...foo_NNNN.jpg
:convert foo.pdf foo_%04d.jpg
Join these
.jpg
s into a single, large file calledfoo.jpg
and add a 2px white border between each image:convert -bordercolor White -border 2x2 foo_0* -append foo.jpg
I'm trying to convert the first page of a PDF to a JPG. I'm pretty sure I got this to work with certain PDFs, but is it really possible that certain PDFs are made incorrectly and cannot be converted?
I tried running this first:
$ convert 10-03-26.pdf[1] test.jpg
And I got the follow:
Error: /syntaxerror in readxref
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1062/1417(ro)(G)-- --dict:0/20(G)-- --dict:73/200(L)-- --dict:73/200(L)-- --dict:97/127(ro)(G)-- --dict:229/230(ro)(G)-- --dict:14/15(L)--
Current allocation mode is local
ESP Ghostscript 7.07.1: Unrecoverable error, exit code 1
convert: Postscript delegate failed `10-03-26.pdf'.
Running this instead:
$ convert -verbose -colorspace rgb '10-03-26.pdf[1]' test.jpg
I get the following:
Error: /syntaxerror in readxref
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1062/1417(ro)(G)-- --dict:0/20(G)-- --dict:73/200(L)-- --dict:73/200(L)-- --dict:97/127(ro)(G)-- --dict:229/230(ro)(G)-- --dict:14/15(L)--
Current allocation mode is local
ESP Ghostscript 7.07.1: Unrecoverable error, exit code 1
"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-g792x1611" "-r72x72" -dFirstPage=2 -dLastPage=2 "-sOutputFile=/tmp/magick-XXU3T44P" "-f/tmp/magick-XXoMKL8Z" "-f/tmp/magic2eec1F"Start of Image
Define Huffman Table 0x00
0 1 5 1 1 1 1 1
1 0 0 0 0 0 0 0
Define Huffman Table 0x01
0 3 1 1 1 1 1 1
1 1 1 0 0 0 0 0
Define Huffman Table 0x10
0 2 1 3 3 2 4 3
5 5 4 4 0 0 1 125
Define Huffman Table 0x11
0 2 1 2 4 4 3 4
7 5 4 4 0 1 2 119
End Of Image
convert: Postscript delegate failed `10-03-26.pdf'.
Why would the conversion fail?
Just as an aside, this is happening on a (gs) Grid-Service on (mt) Media Temple hosting. I cannot install programs on the server, but both Imagemagick and Ghostscript are installed
Thanks!
The issue was that the files need to be made compatible with Acrobat 5.0 in order to work with such an old version of Ghostscript.