PDFtk usage question

  • Follow


Is there a pdftk imprecation I can apply to three PDF files

L.pdf
C.pdf
R.pdf

of dimensions 6x9,2x9, and 6x9, respectively, to obtain as output pdf a
single file for a page that's 14x9 and laid out as depicted below?

+------------------+-------+------------------+
|                  |       |                  |
|                  |       |                  |
|                  |       |                  |
|      L.PDF       | C.PDF |      R.PDF       |
|                  |       |                  |
|                  |       |                  |
|                  |       |                  |
+------------------+-------+------------------+

(I guess I've been made aware that LaTeX can combine PDFs in that way, but
here I'm seeking a pure pdftk solution to that problem if at all possible.)

Many thanks! Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 4/30/2012 8:53:16 PM

On Mon, 30 Apr 2012 16:53:16 -0400, tlvp ci disse:

> Is there a pdftk imprecation I can apply to three PDF files
[...]
not with pdftk, as far I know, but with:

imagemagick (or graphicsmagick)

convert L.pdf C.pdf  R.pdf +append out.pdf

-- 
Puppy Linux wiki:  http://dokupuppylinux.tk
Puppy Linux Forum: http://www.italianpuppy.org/
Windows me genuit, Ubuntu rapuere / tenet nunc Puppy Linux...
invito dropbox 2GB free - http://db.tt/Vc6IeN4
0
Reply elicona (24) 4/30/2012 9:20:08 PM


On Mon, 30 Apr 2012 21:20:08 GMT, Lutrin wrote:

> On Mon, 30 Apr 2012 16:53:16 -0400, tlvp ci disse:
> 
>> Is there a pdftk imprecation I can apply to three PDF files
> [...]
> not with pdftk, as far I know ...

A pity (szkoda!) ...

> ... , but with:
> 
> imagemagick (or graphicsmagick)
> 
> convert L.pdf C.pdf  R.pdf +append out.pdf

Interesting; and good to know. Thanks, Lutrin.

In a similar vein, has imagemagick a *vertical* append function, that would
combine Upper.pdf, Middle.pdf, and Lower.pdf, 8x6, 8x2, and 8x6 again into
a single 8x14 output page, but following the flow shown here below?

+---------------
|
| Upper.pdf
|
+---------------
| Middle.pdf
+---------------
|
| Lower.pdf
|
+---------------

Thanks; got to look those two *magicks up! Cheers, --tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/1/2012 3:26:39 AM

On Mon, 30 Apr 2012 23:26:39 -0400, tlvp wrote:

> On Mon, 30 Apr 2012 21:20:08 GMT, Lutrin wrote:
> 
>> convert L.pdf C.pdf  R.pdf +append out.pdf
> 
> Interesting; and good to know. Thanks, Lutrin.
> 
> In a similar vein, has imagemagick a *vertical* append function, ...

Never mind, I found it: "The "-append" option appends vertically, while the
plus form "+append" appends horizontally." Com' e facile, non e? 

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/1/2012 3:37:12 AM

On Mon, 30 Apr 2012 21:20:08 GMT, Lutrin wrote:

> On Mon, 30 Apr 2012 16:53:16 -0400, tlvp ci disse:
> 
>> Is there a pdftk imprecation I can apply to three PDF files
> [...]
> not with pdftk, as far I know, but with:
> 
> imagemagick (or graphicsmagick)
> 
> convert L.pdf C.pdf  R.pdf +append out.pdf

Hmm ... now that I've downloaded both the Win32 dynamic and the Win32
Portable versions of ImageMagick, I've finally gotten to the great Caveat,
on the page http://www.imagemagick.org/Usage/formats/#vector , that warns:

> Avoid using ImageMagick for 'Vector Image' to 'Vector Image' conversions 
> 
> IM is a 'raster image processor', and while it can read or write images stored
> in one of the vector formats it does so by converting the image to and from a
> internal raster image.
> 
>Consequently if you are trying to convert a image from a vector format, to
> another vector format, IM will essentially rasterize this image at the
> currently defined resolution or density which will hopefully (but
> unlikely) be suitable for the output device you intend to use it on.
> 
> In other words, any output from IM will never be a true vector format.
> While it can convert its internal raster format into a vector format file, the
> result is only a superficial vector image wrapper around an image in
> raster format. And unless the raster image is defined properly (at the right
> resolution) for the output device, the result will not be  particularly good.
> 
> Unfortunately new uses to IM do not know anything about this. They see IM
> as a converter that can convert say PDF to Postscript, producing images
> with 'blocky' aliasing effects, 'washed out' colors, or blurry images that
> just do not look good at all, on the intended output device.

So: yes, ImageMagick's convert can do the job. Just how well, though,
remains to be seen :-) . Other tools may well prove far better ... .

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/1/2012 6:08:10 AM

On 5/1/2012 2:08 AM, tlvp wrote:
> So: yes, ImageMagick's convert can do the job. Just how well, though,
> remains to be seen :-) . Other tools may well prove far better ... .

I'd highly recommend looking at Ghostscript:

http://pages.cs.wisc.edu/~ghost/

For one thing, Ghostscript is (or was) the PDF interpreter part of 
ImageMagick. For another, by using Ghostscript directly, you can avoid 
the rasterization that ImageMagick does. Ghostscript is vastly more 
flexible in manipulating PDF and PostScript.

-pd

0
Reply Peter.Davis (14) 5/1/2012 4:07:53 PM

On Tue, 01 May 2012 12:07:53 -0400, Peter Davis ci disse:

> by using Ghostscript directly, you can avoid the rasterization that
> ImageMagick does.
[...]
Yes. It is true, but I never read that ghostscript is able to 
join *side by side* pdf pages

**

*Multivalent* (latest free version with tools)
- http://ifile.it/iqpjo4s/Multivalent.jar
- http://www.ziddu.com/download/1794145/Multivalent.tar.gz.html

can join *side by side* only pages with *same* geometry (specially 
*width*) and fail to join rightly pages with different width

if we have three pages with different width, we want join *side by side*

http://ge.tt/#!/1p4kw4H

and first we join all in one multipage pdf file

pdftk a.pdf b.pdf c.pdf cat out.pdf

http://ge.tt/#!/1p4kw4H

then, with Multivalent:

java -cp /mnt/home/Multivalent.jar tool.pdf.Impose -dim 3x1 -paper 1490x841pt out.pdf

1490 comes from the sum of different width of three pages
to join (hight is the same in this exsample)

we have this:
- ge.tt/1Y2Ix4H

that is not rightly join *side by side*.

I guess Multivalent can perform this task also with pages having different
width if modified in its behavior
-- 
Puppy Linux wiki:  http://dokupuppylinux.tk
Puppy Linux Forum: http://www.italianpuppy.org/
Windows me genuit, Ubuntu rapuere / tenet nunc Puppy Linux...
invito dropbox 2GB free - http://db.tt/Vc6IeN4
0
Reply elicona (24) 5/1/2012 4:47:30 PM

On 5/1/2012 12:47 PM, Lutrin wrote:
> On Tue, 01 May 2012 12:07:53 -0400, Peter Davis ci disse:
>
>> by using Ghostscript directly, you can avoid the rasterization that
>> ImageMagick does.
> [...]
> Yes. It is true, but I never read that ghostscript is able to
> join *side by side* pdf pages

I'm not sure what you've read, but with Ghostscript, you could at least 
create a page of any size you want, and place the contents of other PDF 
pages anywhere you want on that new page.

-pd

0
Reply Peter.Davis (14) 5/1/2012 5:40:00 PM

On Tue, 01 May 2012 12:07:53 -0400, Peter Davis wrote:

> On 5/1/2012 2:08 AM, tlvp wrote:
>> So: yes, ImageMagick's convert can do the job. Just how well, though,
>> remains to be seen :-) . Other tools may well prove far better ... .
> 
> I'd highly recommend looking at Ghostscript:
> 
> http://pages.cs.wisc.edu/~ghost/
> 
> For one thing, Ghostscript is (or was) the PDF interpreter part of 
> ImageMagick. For another, by using Ghostscript directly, you can avoid 
> the rasterization that ImageMagick does. Ghostscript is vastly more 
> flexible in manipulating PDF and PostScript.
> 
> -pd

Thanks, Peter. There is a ghostscript install on my system, but all it's
ever let me do is visualize a .ps (or an .eps) file. Nothing more. Not even
resize or print out what it displays. This ghostscript install was put in
place by my BullZIP PDF Printer installation, and may be more minimalist
than usual, I don't know. Have you any hints beyond what you just wrote?

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/1/2012 10:26:11 PM

On Tue, 01 May 2012 13:40:00 -0400, Peter Davis wrote:

> On 5/1/2012 12:47 PM, Lutrin wrote:
>> On Tue, 01 May 2012 12:07:53 -0400, Peter Davis ci disse:
>>
>>> by using Ghostscript directly, you can avoid the rasterization that
>>> ImageMagick does.
>> [...]
>> Yes. It is true, but I never read that ghostscript is able to
>> join *side by side* pdf pages
> 
> I'm not sure what you've read, but with Ghostscript, you could at least 
> create a page of any size you want, and place the contents of other PDF 
> pages anywhere you want on that new page.
> 
> -pd

Say I have three PDF files I'd like to assemble so, L.pdf, M.pdf, and R.pdf
-- and I have in mind (x,y)-coordinates their SW corners should get
positioned at on the resulting composite page, as (a,b), (m,n), and (s,t)
-- can you shows me the ghostscript command line that will do that for me
(with output file, say, named Final.pdf)?

(Coordinates (x,y) I imagine as points x to the East and y to the North of
the PDF origin (0,0) in the SW corner of the output page Final.pdf. If
units or positioning are otherwise, please elucidate for me :-) .)

TIA. And cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/1/2012 10:40:00 PM

On Tue, 01 May 2012 16:47:30 GMT, Lutrin wrote:

> On Tue, 01 May 2012 12:07:53 -0400, Peter Davis ci disse:
> 
>> by using Ghostscript directly, you can avoid the rasterization that
>> ImageMagick does.
> [...]
> Yes. It is true, but I never read that ghostscript is able to 
> join *side by side* pdf pages
> 
> **
> 
> *Multivalent* (latest free version with tools)
> - http://ifile.it/iqpjo4s/Multivalent.jar
> - http://www.ziddu.com/download/1794145/Multivalent.tar.gz.html
> 
> can join *side by side* only pages with *same* geometry (specially 
> *width*) and fail to join rightly pages with different width
> 
> if we have three pages with different width, we want join *side by side*
> 
> http://ge.tt/#!/1p4kw4H
> 
> and first we join all in one multipage pdf file
> 
> pdftk a.pdf b.pdf c.pdf cat out.pdf
> 
> http://ge.tt/#!/1p4kw4H
> 
> then, with Multivalent:
> 
> java -cp /mnt/home/Multivalent.jar tool.pdf.Impose -dim 3x1 -paper 1490x841pt out.pdf
> 
> 1490 comes from the sum of different width of three pages
> to join (hight is the same in this exsample)
> 
> we have this:
> - ge.tt/1Y2Ix4H
> 
> that is not rightly join *side by side*.
> 
> I guess Multivalent can perform this task also with pages having different
> width if modified in its behavior

Mi scusi, ma non capisco. -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/1/2012 10:43:39 PM

On 05/01/2012 02:08 AM, tlvp wrote:
[snip]
> So: yes, ImageMagick's convert can do the job. Just how well, though,
> remains to be seen :-) . Other tools may well prove far better ... .
>
Just ran across this, not sure it may help, good luck.
<http://www.pdfsam.org/>
0
Reply jeff8956 (433) 5/2/2012 2:59:07 AM

tlvp wrote in <news:fo2rtlhfplc4.1q96f5yrgykci$.dlg@40tude.net>
>
> Say I have three PDF files I'd like to assemble so, L.pdf, M.pdf, and R.pdf

You might achieve better results if you use 'impose' instead of 
'assemble':

    http://www.google.de/search?&q=pdf+impose

> -- and I have in mind (x,y)-coordinates their SW corners should get 
> positioned at on the resulting composite page, as (a,b), (m,n), and 
> (s,t) -- can you shows me the ghostscript command line that will do 
> that for me (with output file, say, named Final.pdf)?

I don't think one can achieve that with GS without writing custom 
PostScript code like

    http://bugs.ghostscript.com/attachment.cgi?id=1703

> (Coordinates (x,y) I imagine as points x to the East and y to the 
> North of the PDF origin (0,0) in the SW corner of the output page 
> Final.pdf. If units or positioning are otherwise, please elucidate for 
> me :-) .)

If you were on a Mac and the PDF files in question are fully parseable 
by CoreGraphics (CG) you could do the task with either some scripting 
(given CG-bindings are available for the scripting language) or with any 
application that uses CoreGraphics/Quartz to (re)arrange 'images' on a 
sheet eg.

    http://www.macupdate.com/app/mac/23144/fitplot

On MacOS X PDF is just an image format CG can deal with. You can simply 
arrange/position/impose it on a canvas of any size and once you are 
finished the final result is still PDF (and not rasterized) since the 
graphical model of MacOS X (Quartz) is based on PDF internally.

Regards,

Thomas
0
Reply Thomas.Kaiser (36) 5/2/2012 7:28:00 AM

On 5/1/2012 6:26 PM, tlvp wrote:
> On Tue, 01 May 2012 12:07:53 -0400, Peter Davis wrote:
>
>> On 5/1/2012 2:08 AM, tlvp wrote:
>>> So: yes, ImageMagick's convert can do the job. Just how well, though,
>>> remains to be seen :-) . Other tools may well prove far better ... .
>>
>> I'd highly recommend looking at Ghostscript:
>>
>> http://pages.cs.wisc.edu/~ghost/
>>
>> For one thing, Ghostscript is (or was) the PDF interpreter part of
>> ImageMagick. For another, by using Ghostscript directly, you can avoid
>> the rasterization that ImageMagick does. Ghostscript is vastly more
>> flexible in manipulating PDF and PostScript.
>>
>> -pd
>
> Thanks, Peter. There is a ghostscript install on my system, but all it's
> ever let me do is visualize a .ps (or an .eps) file. Nothing more. Not even
> resize or print out what it displays. This ghostscript install was put in
> place by my BullZIP PDF Printer installation, and may be more minimalist
> than usual, I don't know. Have you any hints beyond what you just wrote?

Hi, tlvp,

I'm afraid write a detailed Ghostscript tutorial on how to solve this. 
There is documentation for Ghostscript here:

http://www.ghostscript.com/doc/9.05/Readme.htm

Basically, you can run it with various command line options, including 
the option to run various PostScript programs. PostScript is a 
full-blown programming language that can do a lot of manipulation of 
graphics on pages.

To learn all the ins and outs of PostScript and Ghostscript would be a 
major project, but just imposing multiple pages onto a single one should 
be pretty straightforward.  See, for example, Thomas Kaiser's post in 
this thread.

-pd


0
Reply Peter.Davis (14) 5/2/2012 8:09:00 PM

On Wed, 02 May 2012 16:09:00 -0400, Peter Davis wrote:

> On 5/1/2012 6:26 PM, tlvp wrote:
>> On Tue, 01 May 2012 12:07:53 -0400, Peter Davis wrote:
>>
>>> On 5/1/2012 2:08 AM, tlvp wrote:
>>>> So: yes, ImageMagick's convert can do the job. Just how well, though,
>>>> remains to be seen :-) . Other tools may well prove far better ... .
>>>
>>> I'd highly recommend looking at Ghostscript:
>>>
>>> http://pages.cs.wisc.edu/~ghost/
>>>
> 
> I'm afraid write a detailed Ghostscript tutorial on how to solve this. 
> There is documentation for Ghostscript here:
> 
> http://www.ghostscript.com/doc/9.05/Readme.htm

Thanks, Peter, for that tutorial link above. More helpful than the
executive overview below :-) .
 
> Basically, you can run it with various command line options, including 
> the option to run various PostScript programs. PostScript is a 
> full-blown programming language that can do a lot of manipulation of 
> graphics on pages.
> 
> To learn all the ins and outs of PostScript and Ghostscript would be a 
> major project, but just imposing multiple pages onto a single one should 
> be pretty straightforward.  See, for example, Thomas Kaiser's post in 
> this thread.
> 
> -pd

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/3/2012 12:35:14 AM

On Wed, 2 May 2012 07:28:00 +0000 (UTC), Thomas Kaiser wrote:

> tlvp wrote in <news:fo2rtlhfplc4.1q96f5yrgykci$.dlg@40tude.net>
>>
>> Say I have three PDF files I'd like to assemble so, L.pdf, M.pdf, and R.pdf
> 
> You might achieve better results if you use 'impose' instead of 
> 'assemble':

Sorry, I was using "assemble" in its non-technical everyday layman's sense,
but you seem to be quite right:
 
>     http://www.google.de/search?&q=pdf+impose

"impose" is the technical term best suited to describing, among other
things, just what I'm after (I must confess, AAMOF, that there was only one
technical context for "impose" I'd been aware of, prior to your bringing it
up here, viz., that of getting front and back pages of a duplexed sheet
correctly aligned one with the other).

And several Google finds, as above, offer promise of being just my ticket.
 
>> -- and I have in mind (x,y)-coordinates their SW corners should get 
>> positioned at on the resulting composite page, as (a,b), (m,n), and 
>> (s,t) -- can you shows me the ghostscript command line that will do 
>> that for me (with output file, say, named Final.pdf)?
> 
> I don't think one can achieve that with GS without writing custom 
> PostScript code like
> 
>     http://bugs.ghostscript.com/attachment.cgi?id=1703

I'm still surprised nothing in pdftk's armamentarium is up to it :-) .
 
>> (Coordinates (x,y) I imagine as points x to the East and y to the 
>> North of the PDF origin (0,0) in the SW corner of the output page 
>> Final.pdf. If units or positioning are otherwise, please elucidate for 
>> me :-) .)
> 
> If you were on a Mac and the PDF files in question are fully parseable 
> by CoreGraphics (CG) you could do the task with either some scripting 
> (given CG-bindings are available for the scripting language) or with any 
> application that uses CoreGraphics/Quartz to (re)arrange 'images' on a 
> sheet eg.
> 
>     http://www.macupdate.com/app/mac/23144/fitplot
> 
> On MacOS X PDF is just an image format CG can deal with. You can simply 
> arrange/position/impose it on a canvas of any size and once you are 
> finished the final result is still PDF (and not rasterized) since the 
> graphical model of MacOS X (Quartz) is based on PDF internally.
> 
> Regards,
> 
> Thomas

Thanks, Thomas. Promising avenues you point me to. Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/3/2012 12:51:54 AM

On Wed, 02 May 2012 16:09:00 -0400, Peter Davis wrote:

>  ... just imposing multiple pages onto a single one should 
> be pretty straightforward.  See, for example, Thomas Kaiser's post in 
> this thread.

Heh-heh ... found that only much later, as in my Dialog installation the
thread looks split in two, the second part starting with Lutrin's response
of 5/1/2012 4:47:30 PM GMT (MID: <pan.2012.05.01.10.45.54@lutrina>).

But yes, indeed, there's much for me to learn in Kaiser's post, thanks.

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.
0
Reply mPiOsUcB.EtLlLvEp (145) 5/3/2012 12:57:16 AM

On 5/2/2012 4:09 PM, Peter Davis wrote:
> I'm afraid write a detailed Ghostscript tutorial on how to solve this.

Geez, I guess it pays to proofread.  What I meant to say is:

I'm afraid I don't have time to write a ...

The rest still applies.

-pd
0
Reply Peter.Davis (14) 5/3/2012 5:45:49 PM

17 Replies
135 Views

(page loaded in 0.241 seconds)

Similiar Articles:


















7/23/2012 10:14:13 AM


Reply: