Re: PDF Manipulation was Design Question

2020-11-19 Thread doc hawk via use-livecode
*IF* the pdf files are simple enough, there are some substitutions that you can 
“just make”.

A string literal can be replaced with a string of the same length.  It could 
also be replaced with a shorter string and space-padded for the extra space.

You want to put a string that is three characters longer, as I understand.   
*IF* there are three characters of white space or comment before the linefeed 
preceding the next “real” data, you could also substitute.

Encryption would obviously stop this.

Also, it’s common in some autogenerated forms to find things like “T e x t” 
instead of “Text”, or even spacing information between characters.


When my ambition comes back, I’m working on livecode to “layer” pdfs for form 
filling.   I just have to get the hang of the spacing.

It seems that a pdf can be included as an object in another pdf.

If the pdf widget could actually, well, output a pdf, rather than a 
screen-density image of it, my life would be *so* much easier and I could sell 
this thing I’ve put together over a decade tomorrow . . .

Or look at the source code of PyPDF2 (it’s BSD/Free licensing, not GPL, so you 
don’t get contaminated), which has all kinds of pdf manipulation stuff (I’ll 
leave it to others to comment on the effects on your health of reading that 
much python . . .



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: PDF Manipulation was Design Question

2020-11-19 Thread John McKenzie via use-livecode


 Bob S:

 Thanks for replying to my post. It seems the situation is as I thought
although making a GUI with Livecode to activate an external library is
easier than using other tools to make a GUI for an external library.
When I started this conversation I assumed I would something like that.


 No, it is not form data we are dealing with. A static, non-secure, PDF
file is sent to us. We print it, scan it, label the flights with the
needed codes by hand, scan the printed copy with the labels and email
the scan to someone.

 Hoping to improve the situation to at least the point where they send
the PDF file and then we run a programme that creates a new PDF which
is sent back to the originator.



 I have successfully used the FDF data format for something unrelated
but at work in the past. It would be great if it were the case here, but
alas, it is not.









___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: PDF Manipulation was Design Question

2020-11-18 Thread Bob Sneidar via use-livecode
That should have read preconfigured to read the FDF file (stupid spell correct!)

Bob S


On Nov 18, 2020, at 12:15 PM, Bob Sneidar via use-livecode 
mailto:use-livecode@lists.runrev.com>> wrote:

preconfigured to read the pdf file of course

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: PDF Manipulation was Design Question

2020-11-18 Thread Bob Sneidar via use-livecode
If you are talking about form data, there IS a way to configure a PDF so that 
it reads a data file contains just form data and populates with the new data. 
This works with Mac and Windows, and I assume with Linux, but the caveat is 
that the PDF has to be configured to do this first.

The format is not difficult to grok. I use it in my Forms Generator app 
extensively to fill blank forms with data from an SQL server. I have handlers 
for reading and creating these files (they end in .fdf). It get’s a little more 
difficult to understand when dealing with things like check boxes and radio 
buttons, and especially tables. For instance the two default values for a 
checkbox (unless you modify the checkbox object in the PDF) is false and yes.

My application has an interface for importing a pre-existing fillable form 
(preconfigured to read the pdf file of course), creating relationships between 
the database columns and the form objects, and saving those relationships along 
with the binary data to recreate the pdf on demand, in the SQL database.

Is that what you need?

Bob S


On Nov 18, 2020, at 12:02 PM, Bob Sneidar via use-livecode 
mailto:use-livecode@lists.runrev.com>> wrote:

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.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: PDF Manipulation was Design Question

2020-11-18 Thread Bob Sneidar via use-livecode


On Nov 18, 2020, at 10:34 AM, John McKenzie via use-livecode 
mailto:use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode