Re: [gentoo-user] Joining PDF files together.

2020-07-10 Thread Alan Mackenzie
Hello, everybody on Gentoo.

On Thu, Jul 09, 2020 at 13:31:36 +, Alan Mackenzie wrote:
> I've just scanned in a two-page document using sane, and it's given me
> as output two separate files.  I would like to join these together into
> a single document.

> Would somebody please suggest to me an appropriate package to do this
> with.

Thanks to everybody who responded with a suggestion.  In the end, I used
pdfunite, simply because it was there.  I don't have (and don't want)
Java on my system, so that ruled out pdftk.

Gerrit, you were quite right about sane producing ludicrously large PDF
files.  I should have cut my file down before emailing it off, but
laziness got the better of me.  :-(

gentoo-user is a tremendous group!

> Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).



Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Jarry
On 09-Jul-20 19:32, Jack wrote:
> On 2020.07.09 13:25, Jarry wrote:
>> On Thu, 9 Jul 2020 at 16:32, Alan Mackenzie  wrote:
>> > I've just scanned in a two-page document using sane, and it's given me
>> > as output two separate files.  I would like to join these together into
>> > a single document.
>> >
>> > Would somebody please suggest to me an appropriate package to do this
>> > with.
>>
>> Sorry for stealing this topic, but does any of mentioned packages
>> support "overlapping" one pdf-page over the other? Not sure if
>> I'm using the right word, but what I mean is "joining" two pdf
>> pages of the same size to single page, with content of both those
>> original pages written over each other to single output page.
>>
>> I have been using "stamp" option of pdftk for this, but it crashes
>> sometimes...
> I haven't done it, but would gimp work?  It might be overkill, but
> something about layers sounds appropriate.
> 

It might work, but I'm doing it sometimes on large batches of files,
so I'd prefer scripted solution. From my experience pdftk crashes
about 4-5 times out of 100 operations. So I have to find those cases
when it failed and run them again...

Jarry

-- 
___
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.



Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Matt Connell (Gmail)
On Thu, 2020-07-09 at 13:32 -0400, Jack wrote:
> I haven't done it, but would gimp work?  It might be overkill, but  
> something about layers sounds appropriate.

Gimp can in fact do this, I just tested it.  You'll need to mess with
transparency perhaps, but as a proof-of-concept you can "paste as new
layer" with a PDF page layer from another file.




Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Jack

On 2020.07.09 13:25, Jarry wrote:

On Thu, 9 Jul 2020 at 16:32, Alan Mackenzie  wrote:
> I've just scanned in a two-page document using sane, and it's given  
me
> as output two separate files.  I would like to join these together  
into

> a single document.
>
> Would somebody please suggest to me an appropriate package to do  
this

> with.

Sorry for stealing this topic, but does any of mentioned packages
support "overlapping" one pdf-page over the other? Not sure if
I'm using the right word, but what I mean is "joining" two pdf
pages of the same size to single page, with content of both those
original pages written over each other to single output page.

I have been using "stamp" option of pdftk for this, but it crashes
sometimes...
I haven't done it, but would gimp work?  It might be overkill, but  
something about layers sounds appropriate.




Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Jarry
On Thu, 9 Jul 2020 at 16:32, Alan Mackenzie  wrote:
> I've just scanned in a two-page document using sane, and it's given me
> as output two separate files.  I would like to join these together into
> a single document.
>
> Would somebody please suggest to me an appropriate package to do this
> with.

Sorry for stealing this topic, but does any of mentioned packages
support "overlapping" one pdf-page over the other? Not sure if
I'm using the right word, but what I mean is "joining" two pdf
pages of the same size to single page, with content of both those
original pages written over each other to single output page.

I have been using "stamp" option of pdftk for this, but it crashes
sometimes...

Jarry

-- 
___
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.



Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Neil Bothwick
On Thu, 9 Jul 2020 11:30:17 -0400, Rich Freeman wrote:

> > app-text/pdftk
> >
> > pdftk page-1.pdf page-2.pdf cat output both.pdf
> >
> > Lots of other useful tricks it can do with pdf files.
> >  
> 
> +1 for pdftk if you can stand java.  I'm sure there are some GUI-based
> options that you might prefer, but pdftk is great for command line
> use.

I'll add another vote for pdfunite, it's already installed on most
systems as it's part of poppler and it's as simple as

pdfunite file1 file2 ... output.pdf


-- 
Neil Bothwick

A Microsoft joke (is that a tautology?)


pgpG9tKoM4Ko0.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Simo Tukiainen
On Thu, 9 Jul 2020 at 16:32, Alan Mackenzie  wrote:
> I've just scanned in a two-page document using sane, and it's given me
> as output two separate files.  I would like to join these together into
> a single document.
>
> Would somebody please suggest to me an appropriate package to do this
> with.

You already have many suggestions, but I'll mention app-text/pdfjam
(and pdfjoin it provides) just for completeness. I use it like this to
merge scanned documents:
$ pdfjoin --rotateoversize false --outfile x.pdf y-*.pdf

It's command line and only depends on virtual/latex-base so may be a
nice option if you already have a latex installed.


Regards,
Simo



Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Tamer Higazi

Ghostscript is installed by most pdf distributions, and if not merge it.

Look here:

gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=myoutput.pdf 
fil21.pdf file2.pdf file3.pdf



best, Tamer

On 2020-07-09 17:39, Gerrit Kuehn wrote:

On Thu, 9 Jul 2020 13:31:36 +
Alan Mackenzie  wrote:


Would somebody please suggest to me an appropriate package to do this
with.

I use ImageMagick for joining pages scanned with xsane:

convert page1 page2 pages.pdf

Note that especially for pdf files, tools like pdftk or pdfjam will
probably produce better results. However, (x)sane usually produces
very large pdf files. So you may receive better end results creating
separate png files with sane and then join these (using ImageMagick as
shown above).


cu
   Gerrit





Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Gerrit Kuehn


On Thu, 9 Jul 2020 13:31:36 +
Alan Mackenzie  wrote:

> Would somebody please suggest to me an appropriate package to do this
> with.

I use ImageMagick for joining pages scanned with xsane:

convert page1 page2 pages.pdf

Note that especially for pdf files, tools like pdftk or pdfjam will
probably produce better results. However, (x)sane usually produces
very large pdf files. So you may receive better end results creating
separate png files with sane and then join these (using ImageMagick as
shown above).


cu
  Gerrit



Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Tamer Higazi

Dear Alan,

I do it with ghostscript (for my cv's and employers proof of work) all 
the time, and even change the header.


Then look here:

http://milan.kupcevic.net/ghostscript-ps-pdf/

the best short documentation I found so far.


best, Tamer

On 2020-07-09 15:31, Alan Mackenzie wrote:

Hello, Gentoo.

I've just scanned in a two-page document using sane, and it's given me
as output two separate files.  I would like to join these together into
a single document.

Would somebody please suggest to me an appropriate package to do this
with.

Thanks!

Other than that, Gentoo just keeps working for me, so I've not much to
say on this list.  ;-)





Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Rich Freeman
On Thu, Jul 9, 2020 at 9:35 AM John Blinka  wrote:
>
> app-text/pdftk
>
> pdftk page-1.pdf page-2.pdf cat output both.pdf
>
> Lots of other useful tricks it can do with pdf files.
>

+1 for pdftk if you can stand java.  I'm sure there are some GUI-based
options that you might prefer, but pdftk is great for command line
use.

I'll go ahead and offer this script that takes as input a bunch of pdf
files, and it combines them all adding blank pages as needed to make
them all even.  This is used to generate a combined PDF suitable for
double-sided printing on a single-sided printer if I have a bunch of
PDFs I want to print in batch.

#!/bin/bash
for file in *.pdf
do
  #get the number of pages
  numberofpages=`pdftk "$file" dump_data | sed -e
'/NumberOfPages/!d;s/NumberOfPages: //'`
  echo -n "$file" 'has' $numberofpages 'pages, '

  uneven=$(($numberofpages % 2))
  if [ $uneven == 1 ]
  then
echo 'which is uneven - added 1 more'
tempfile=`mktemp`
pdftk A="$file" B=/usr/local/share/blank.pdf cat A B1 output "$tempfile"
mv $tempfile $file
  else
echo 'which is even'
  fi
done

pdftk *.pdf cat output out.pdf



-- 
Rich



Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Matt Connell (Gmail)
> I have no experience with either myself, but I think you can use
> either pdftk, or the pdfunite command in the poppler package.

+1 for poppler

It includes easy-to-use tools for uniting, separating, and converting
PDFs to other formats.

Also worth noting, pdftk requires java, which some users may not want
to install.  Unless I'm mistaken, poppler is a Qt application.




Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread Remco Rijnders
On Thu, Jul 09, 2020 at 01:31:36PM +, Alan wrote in 
<20200709133136.GA4852@ACM>:

Hello, Gentoo.

I've just scanned in a two-page document using sane, and it's given me
as output two separate files.  I would like to join these together into
a single document.

Would somebody please suggest to me an appropriate package to do this
with.


I have no experience with either myself, but I think you can use
either pdftk, or the pdfunite command in the poppler package.



Re: [gentoo-user] Joining PDF files together.

2020-07-09 Thread John Blinka
On Thu, Jul 9, 2020 at 9:31 AM Alan Mackenzie  wrote:

> Hello, Gentoo.
>
> I've just scanned in a two-page document using sane, and it's given me
> as output two separate files.  I would like to join these together into
> a single document.
>
> Would somebody please suggest to me an appropriate package to do this
> with.
>
> Thanks!
>
> Other than that, Gentoo just keeps working for me, so I've not much to
> say on this list.  ;-)
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
> app-text/pdftk

pdftk page-1.pdf page-2.pdf cat output both.pdf

Lots of other useful tricks it can do with pdf files.

hth -

John Blinka


[gentoo-user] Joining PDF files together.

2020-07-09 Thread Alan Mackenzie
Hello, Gentoo.

I've just scanned in a two-page document using sane, and it's given me
as output two separate files.  I would like to join these together into
a single document.

Would somebody please suggest to me an appropriate package to do this
with.

Thanks!

Other than that, Gentoo just keeps working for me, so I've not much to
say on this list.  ;-)

-- 
Alan Mackenzie (Nuremberg, Germany).