Page 1 of 1

Merging PDF Files

Posted: Sat May 27, 2017 4:04 pm
by PeterG
Hi All
I just want to know if it is at all possible to merge PDF files using LC script without external command line tools, or is there a reliable External or library that one could use to achieve this that gives one the ability to let the user select the order in which the files are merged(Windows Environment). I do apologize if this was discussed in previous posting but I failed to locate any.

Peter G

Re: Merging PDF Files

Posted: Sat May 27, 2017 10:31 pm
by SparkOut
Not as far as I know. This is as good a solution as I think is possible :
http://forums.livecode.com/viewtopic.ph ... 7&p=154251

Re: Merging PDF Files

Posted: Mon May 29, 2017 7:16 pm
by PeterG
Thanks for the reply
Currently using a third party tool called "pdftk" to merge PDF files.
Here is my code:

Code: Select all

ask question "Type in the name of the file. (name.PDF)" titled "Merge File Name"
put it into  gFilename
get shell( "pdftk *.pdf output combined.pdf")
end mouseUp
I gues I have to work on a script that will produce the shell string to look something like this:
"get shell( "pdftk 1.pdf, 2.pdf, 3.pdf, 4.pdf output combined.pdf")"

Thanks
Peter G

Re: Merging PDF Files

Posted: Mon May 29, 2017 8:31 pm
by [-hh]
The docs:
https://www.pdflabs.com/docs/pdftk-man-page/

"Merging" is not the default operation, you have to use the operation "cat" and name all files to merge/cat in the correct input order. There are examples listed.

For me it works best to try first from the commandLine/Terminal, then use LC with the working line or build an appropriate line by script.

Re: Merging PDF Files

Posted: Thu Jun 01, 2017 4:52 pm
by PeterG
Many Thanks
Have in the meantime started playing with the "cat" option.
I have to present the user with the list of PDF files in a selected folder and somehow get the user to set / select the order to build the command line.

Am I correct in thinking along these lines or should I choose another approach.

Many thanks for the advice
Peter G