2

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

3
  • What operating system?
    – terdon
    Jun 21, 2013 at 14:50
  • i am using Ubuntu.. the server is on linux ? no idea what the OS has to do with it Jun 24, 2013 at 7:09
  • The tools available to do this can depend on the operating system you are using. Could you please clarify what you're trying to do? Do you want to make a single pdf from multiple jpg images or convert a multipage pdf into one large jpg image?
    – terdon
    Jun 24, 2013 at 13:48

2 Answers 2

1

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.

2
  • 1
    +1, thanks for posting the solution. It is strange though, I tried that and was getting white pages, the border seemed to be taking the entire page. That's why I had to split first. Are you sure that works as you want it to? What version of convert are you using? Maybe there is a bug in mine (6.7.7-10).
    – terdon
    Jun 26, 2013 at 13:34
  • i am really sorry i am quite weak in finding the version of convert. although here is the code i used TCPDF library, codeigniter, { @exec( "convert -append -bordercolor White -border 20x20 " . $_pdf_path . " " . $_image_path ); } Jun 27, 2013 at 15:05
0

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:

  1. 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
    
  2. Join these .jpgs into a single, large file called foo.jpg and add a 2px white border between each image:

    convert -bordercolor White -border 2x2 foo_0* -append foo.jpg
    
1
  • agreed. this works but we can do this in one like too convert -append -bordercolor White -border 20x20 path.pdf path2.jpg Jun 26, 2013 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .