LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-29-2013, 08:48 PM   #1
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Rep: Reputation: 47
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.

Last edited by rng; 05-29-2013 at 10:06 PM.
 
Old 05-29-2013, 09:06 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
Old 05-29-2013, 09:35 PM   #3
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Original Poster
Rep: Reputation: 47
@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.
 
Old 05-29-2013, 11:47 PM   #4
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Original Poster
Rep: Reputation: 47
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.

Last edited by rng; 05-29-2013 at 11:57 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] merge pdf files with each file as a index entry in the big pdf ununun Linux - General 4 12-08-2017 07:23 AM
How to search contents of multiple pdf files and return the pdf's file name? Hoxygen232 Linux - Newbie 4 04-28-2013 09:39 AM
[SOLVED] Is there a PDF editor that can edit ALL of a PDF file? Not just a form filler carloslosgrande Linux - Software 1 11-16-2011 02:24 AM
How to modify a field in few lines in a file and save the new file - in Perl rounak94 Programming 1 10-02-2008 07:43 PM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration