Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
What operating system? –  terdon Jun 21 '13 at 14:50
    
i am using Ubuntu.. the server is on linux ? no idea what the OS has to do with it –  Hammad Khalid Jun 24 '13 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 '13 at 13:48
add comment

2 Answers

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.

share|improve this answer
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 '13 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 ); } –  Hammad Khalid Jun 27 '13 at 15:05
add comment

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
    
share|improve this answer
    
agreed. this works but we can do this in one like too convert -append -bordercolor White -border 20x20 path.pdf path2.jpg –  Hammad Khalid Jun 26 '13 at 9:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.