Merging PDF Files

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gagsoft
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Merging PDF Files

Post by gagsoft » Sat May 27, 2017 4:04 pm

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

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Merging PDF Files

Post by SparkOut » Sat May 27, 2017 10:31 pm

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

gagsoft
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Re: Merging PDF Files

Post by gagsoft » Mon May 29, 2017 7:16 pm

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

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Merging PDF Files

Post by [-hh] » Mon May 29, 2017 8:31 pm

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.
shiftLock happens

gagsoft
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Re: Merging PDF Files

Post by gagsoft » Thu Jun 01, 2017 4:52 pm

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”