PDF Manipulation was Design Question

Bob Sneidar bobsneidar at iotecdigital.com
Wed Nov 18 15:02:18 EST 2020



On Nov 18, 2020, at 10:34 AM, John McKenzie via use-livecode <use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>> wrote:


Comments people were making to William in the Design Question thread
have caused me to question some things and I am going to the list here
to get an answer.

Can Livecode edit existing PDF files? I would think this far beyond
its scope and just not the sort of thing it would be involved with. Am
I wrong on that though?

Short answer, no. Long answer, it depends. On a Macintosh, AppleScript can be used to manipulate form objects, but as far as the actual “burned in” content, I do not think so. This is on purpose, as if this were possible, PDFs could not be secure. Also if the PDF has been secured, nothing can modify it.

On a PC, there are libraries for C++ and Java that allow manipulation of PDFs, again dependent on the PDFs own security settings.

In either case, Acrobat has certain security features built in, so that some things cannot be modified by an API if it does not have the proper security context. It is kind of like variable scoping, but from a security point of view. That may not be a great analogy, but to get more info read the Javascript API to learn what I am talking about.

https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf

Bob S


At my work we have a, frankly stupid, situation that could be made so
much easier if we had software do a simple function. All that is needed
is that a PDF file that comes to me gets some of its text changed and
the changes are according to a specific pattern.

I thought about getting around to making something that would do that
in one of the more powerful scripting languages. However, if I could use
Livecode it would have some advantages. Namely it would be easier to
create and be very multi-platform.

So here I am having assumed that Livecode is not a tool that could
do what I want but now asking can I use it to automate editing text in a
PDF file?



The edits are simple, BTW. I work at an airport and it would just need
to replace a flight number with the flight number and code next to it.
The code is always the same for a particular route.

So for example, if the incoming PDF has the text "WS252" on it I would
want it changed to "WS252 LV". Each file would have 20-30 flights to
change like this.

Thanks.

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list