Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #27435 > unrolled thread
| Started by | db <dieterhansbritz@gmail.com> |
|---|---|
| First post | 2019-06-24 14:31 +0000 |
| Last post | 2019-07-02 02:42 +0000 |
| Articles | 8 — 8 participants |
Back to article view | Back to comp.os.linux.misc
Use of pdftk db <dieterhansbritz@gmail.com> - 2019-06-24 14:31 +0000
Re: Use of pdftk Joe Makowiec <makowiec@invalid.invalid> - 2019-06-24 15:46 +0000
Re: Use of pdftk Richard Kettlewell <invalid@invalid.invalid> - 2019-06-24 17:00 +0100
Re: Use of pdftk Bit Twister <BitTwister@mouse-potato.com> - 2019-06-24 11:36 -0500
Re: Use of pdftk Andreas Kohlbach <ank@spamfence.net> - 2019-06-24 14:21 -0400
Re: Use of pdftk Rich <rich@example.invalid> - 2019-06-24 18:38 +0000
Re: Use of pdftk au76666 <britz@chem.au.dk> - 2019-07-05 08:09 +0000
Re: Use of pdftk Jack Strangio <jackstrangio@yahoo.com> - 2019-07-02 02:42 +0000
| From | db <dieterhansbritz@gmail.com> |
|---|---|
| Date | 2019-06-24 14:31 +0000 |
| Subject | Use of pdftk |
| Message-ID | <qeqms8$oua$1@dont-email.me> |
I have a large number of pdf files I want to chain together into a single file. They come from Windows and the names all have spaces in them. I can do it by typing in, e.g. pdftk 'ab c.pdf' 'e fg.pdf' ... output z.pdf This has worked for me with a smaller set, but for this one it's so many that I want to do it using a script. I tried something like this: pdftk 'ab c.pdf' \ 'e fg.pdf' \ ... output z.pdf (the names afre all long, hence the \), as a script. Chmod it and try to run it, and it says it can't find those files. What is the difference, and how can I do it? I would use ls to get a list and emacs the extra stuff into it. But how can I get it to run? -- Dieter Britz
[toc] | [next] | [standalone]
| From | Joe Makowiec <makowiec@invalid.invalid> |
|---|---|
| Date | 2019-06-24 15:46 +0000 |
| Message-ID | <XnsAA7877C56C16FmakowiecatnycapdotrE@144.76.35.198> |
| In reply to | #27435 |
On 24 Jun 2019 in comp.os.linux.misc, db wrote: > I have a large number of pdf files I want to chain together into > a single file. They come from Windows and the names all have spaces > in them. I can do it by typing in, e.g. > > pdftk 'ab c.pdf' 'e fg.pdf' ... output z.pdf > > This has worked for me with a smaller set, but for this one it's > so many that I want to do it using a script. I tried something like > this: > > pdftk 'ab c.pdf' \ > 'e fg.pdf' \ > ... > output z.pdf > > (the names afre all long, hence the \), > as a script. Chmod it and try to run it, and it says it can't find > those files. What is the difference, and how can I do it? I would > use ls to get a list and emacs the extra stuff into it. But how > can I get it to run? xargs? I'm spitballing this, but maybe something like: find /path/to/dir/ -name '*.pdf' | xargs -0 /path/to/pdftk output z.dpf The -ZERO switch allows you to use files with spaces and other odd characters in filenames. "man xargs" for more information. Note - didn't try this. It shouldn't be destructive, but you might want to run it on a copy of your files. -- Joe Makowiec http://makowiec.org/ Email: http://makowiec.org/contact/?Joe Usenet Improvement Project: http://twovoyagers.com/improve-usenet.org/
[toc] | [prev] | [next] | [standalone]
| From | Richard Kettlewell <invalid@invalid.invalid> |
|---|---|
| Date | 2019-06-24 17:00 +0100 |
| Message-ID | <878strug6k.fsf@LkoBDZeT.terraraq.uk> |
| In reply to | #27435 |
db <dieterhansbritz@gmail.com> writes: > I have a large number of pdf files I want to chain together into > a single file. They come from Windows and the names all have spaces > in them. I can do it by typing in, e.g. > > pdftk 'ab c.pdf' 'e fg.pdf' ... output z.pdf > > This has worked for me with a smaller set, but for this one it's > so many that I want to do it using a script. I tried something like > this: > > pdftk 'ab c.pdf' \ > 'e fg.pdf' \ > ... > output z.pdf > > (the names afre all long, hence the \), > as a script. Chmod it and try to run it, and it says it can't find > those files. What is the difference, and how can I do it? I would > use ls to get a list and emacs the extra stuff into it. But how > can I get it to run? It’s not possible to debug a script without being able to see it. The exact error message is also likely to be necessary. Seeing “something like” it isn’t enough. -- https://www.greenend.org.uk/rjk/
[toc] | [prev] | [next] | [standalone]
| From | Bit Twister <BitTwister@mouse-potato.com> |
|---|---|
| Date | 2019-06-24 11:36 -0500 |
| Message-ID | <slrnqh1uvk.8bl.BitTwister@wb.home.test> |
| In reply to | #27435 |
On Mon, 24 Jun 2019 14:31:36 -0000 (UTC), db wrote:
> I have a large number of pdf files I want to chain together into
> a single file. They come from Windows and the names all have spaces
> in them. I can do it by typing in, e.g.
>
> pdftk 'ab c.pdf' 'e fg.pdf' ... output z.pdf
>
> This has worked for me with a smaller set, but for this one it's
> so many that I want to do it using a script. I tried something like
> this:
>
> pdftk 'ab c.pdf' \
> 'e fg.pdf' \
> ...
> output z.pdf
>
> (the names afre all long, hence the \),
> as a script. Chmod it and try to run it, and it says it can't find
> those files. What is the difference, and how can I do it? I would
> use ls to get a list and emacs the extra stuff into it. But how
> can I get it to run?
I can not find pdftk rpm for my Mageia Linux Release distribution.
I did install pdfsam rpm which has a gui front end for a few of the pdf
apps that do the work. I did find pdfunite which does not use/require
the "output" keyword.
Using ls -1Q | sort -V I got the file list double quoted, added pdfunite
and desired output filename, result, ignore leading whitespaces.
pdfunite \
"1 pdfsam 2018TaxReturn.pdf" \
"2 pdfsam 2018TaxReturn.pdf" \
"3 pdfsam 2018TaxReturn.pdf" \
"4 pdfsam 2018TaxReturn.pdf" \
"5 pdfsam 2018TaxReturn.pdf" \
"6 pdfsam 2018TaxReturn.pdf" \
"7 pdfsam 2018TaxReturn.pdf" \
"8 pdfsam 2018TaxReturn.pdf" \
"9 pdfsam 2018TaxReturn.pdf" \
"10 pdfsam 2018TaxReturn.pdf" \
"11 pdfsam 2018TaxReturn.pdf" \
"12 pdfsam 2018TaxReturn.pdf" \
"13 pdfsam 2018TaxReturn.pdf" \
/home/bittwister/a/z.pdf
and had no problems.
[toc] | [prev] | [next] | [standalone]
| From | Andreas Kohlbach <ank@spamfence.net> |
|---|---|
| Date | 2019-06-24 14:21 -0400 |
| Message-ID | <8736jyalpv.fsf@usenet.ankman.de> |
| In reply to | #27435 |
On Mon, 24 Jun 2019 14:31:36 -0000 (UTC), db wrote: > > I have a large number of pdf files I want to chain together into > a single file. They come from Windows and the names all have spaces > in them. I can do it by typing in, e.g. > > pdftk 'ab c.pdf' 'e fg.pdf' ... output z.pdf > > This has worked for me with a smaller set, but for this one it's > so many that I want to do it using a script. I tried something like > this: > > pdftk 'ab c.pdf' \ > 'e fg.pdf' \ > ... > output z.pdf > > (the names afre all long, hence the \), > as a script. Chmod it and try to run it, and it says it can't find > those files. What is the difference, and how can I do it? I would > use ls to get a list and emacs the extra stuff into it. But how > can I get it to run? Something like gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf "*.pdf" should work. -- Andreas My random thoughts and comments https://news-commentaries.blogspot.com/
[toc] | [prev] | [next] | [standalone]
| From | Rich <rich@example.invalid> |
|---|---|
| Date | 2019-06-24 18:38 +0000 |
| Message-ID | <qer5c0$ij5$1@dont-email.me> |
| In reply to | #27435 |
db <dieterhansbritz@gmail.com> wrote: > I have a large number of pdf files I want to chain together into > a single file. They come from Windows and the names all have spaces > in them. I can do it by typing in, e.g. > > pdftk 'ab c.pdf' 'e fg.pdf' ... output z.pdf > > This has worked for me with a smaller set, but for this one it's > so many that I want to do it using a script. I tried something like > this: Why use a script? If they are the only PDF's in the current dir that you want to combine, then this should work (even with spaces): pdftk *.pdf output z.pdf If they are not the only pdf's in the current dir, then move them into their own temporary directory, and run the pdftk command from within that temporary directory. Note that this will combine them in the order that they sort by looking at the filenames as a string of bytes. If you want them reordered into a different order than what their names sort into, then you either have to manually enter each (tab key helps here) or you have to rename them so they are ordered the way you want first (i.e., prefix 0000- 0001- 0002- 0003- etc. to each to put it in its ordering, you can also use the old BASIC programmer trick of number by 10's to leave space to put something in the middle).
[toc] | [prev] | [next] | [standalone]
| From | au76666 <britz@chem.au.dk> |
|---|---|
| Date | 2019-07-05 08:09 +0000 |
| Message-ID | <qfn0ji$nhb$1@dont-email.me> |
| In reply to | #27442 |
On Mon, 24 Jun 2019 18:38:56 +0000, Rich wrote: > db <dieterhansbritz@gmail.com> wrote: >> I have a large number of pdf files I want to chain together into a >> single file. They come from Windows and the names all have spaces in >> them. I can do it by typing in, e.g. >> >> pdftk 'ab c.pdf' 'e fg.pdf' ... output z.pdf >> >> This has worked for me with a smaller set, but for this one it's so >> many that I want to do it using a script. I tried something like this: > > Why use a script? If they are the only PDF's in the current dir that > you want to combine, then this should work (even with spaces): > > pdftk *.pdf output z.pdf [...] That was it, thanks! Why didn't I think of that? You can't answer that. -- Dieter Britz
[toc] | [prev] | [next] | [standalone]
| From | Jack Strangio <jackstrangio@yahoo.com> |
|---|---|
| Date | 2019-07-02 02:42 +0000 |
| Message-ID | <ptzu64.o5F@yahoo.com> |
| In reply to | #27435 |
db <dieterhansbritz@gmail.com> writes:
> I have a large number of pdf files I want to chain together into
> a single file. They come from Windows and the names all have spaces
> in them.
>
> This has worked for me with a smaller set, but for this one it's
> so many that I want to do it using a script. I tried something like
> this:
Get your script to disregard spaces (etc) when reading in argument
lines by inserting this line near the top of it
IFS="$(printf '\n\t')"
That will then consider a tab or a newline ONLY as separators.
Then you can read in a whole list of filenames without the spaces killing
your input arguments.
Regards,
Jack
--
"I'm a home-loving girl. And that's where I wish I was."
"At home ..."
"Loving."
- Laugh-In, 1968
[toc] | [prev] | [standalone]
Back to top | Article view | comp.os.linux.misc
csiph-web