LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to modify a pdf file in this manner (https://www.linuxquestions.org/questions/linux-general-1/how-to-modify-a-pdf-file-in-this-manner-4175464027/)

rng 05-29-2013 08:48 PM

How to modify a pdf file in this manner
 
I have a pdf file which I want to modify in the following manner: I want to combine pages 1 and 2 side-by-side and put them on one page in landscape mode, so that they appear like an open book. I want to repeat this for pages 3 and 4, pages 5 and 6 etc. Is it possible using pdftk or some other pdf modifying tool? Does it need to be converted first to jpg images and then combined? I can think of following steps but do not know how to implement them:
1. pull out all individual pages of pdf
2. convert them to jpg files
3. combine 2 jpg files into one keeping them adjacent
4. combine these jpg files into one pdf

Thanks for your help.

evo2 05-29-2013 09:06 PM

Hi,

perhaps I'm missing something here, but this looks like a simple case of "nup", and is the default operation for pdfnup when run without options. Eg
Code:

pdfnup infile.pdf outfile.pdf
In Debian pdfnup is in the texlive-extra-utils package, so it is probably the same in Ubuntu.

HTH,

Evo2.

rng 05-29-2013 09:35 PM

@evo2:
Thanks for your help. You have made it really simple! The pdfnup seems to be part of pdfjam package (220mb on linux mint) or I can install texlive-extra-utils only (90mb). I am trying to install this and will come back with the result.

rng 05-29-2013 11:47 PM

I am away from my main computer and internet bandwidth is very limited here.

I can do step 1 with command: pdftk largepdfile.pdf burst : pg_0001.pdf, pg_0002.pdf etc will be made;

Conversion to jpg can be done with command: for f in *.pdf; do convert $f.pdf $f.jpg; done

For joining 2 files side-by-side: i=0; k=0; while (i<100); do j = ( $i + 1); convert +adjoin pg_$i.pdf pg_$j.pdf pg_$k.jpg; i++; k++; done

Convert first file to pdf: convert pg_0.jpg pg_0.pdf

For joining such file again one below the other: i=i; while (i<50); convert -adjoin pg_0.pdf pg_$i.pdf pg_0.jpg; i++; done;

Will these commands work? Thanks for your help.


All times are GMT -5. The time now is 08:59 AM.