walter.h.brown at gmail.com
Mon Dec 6 09:34:59 EST 2010
I have had some success with documents by investigating their internal
structure and adding or editing an appropriate object. The issue with many
is that you may also have to recalculate length, checksum, signatures,
internal pointer, etc. elements in the document file as well. Some elements
may also be encrypted. Also, the content of one element may be closely tied,
in unexpected ways if you don't know the format details, with the content of
another element (as Jan describes).
One tool (I am not vouching for it, I just found it as an example) is the
pdf toolkit (http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/). Just
reading it's feature list is illuminating about what CAN be done with a PDF.
Of interest is an ad on that page for an O'Reilly book they authored, "PDF
Hacks". I don't know what overlap that may have with Jan's tools.
From: use-livecode-bounces at lists.runrev.com
[mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Josh Mellicker
Sent: Monday, December 06, 2010 3:22 AM
To: How to use LiveCode
Subject: Re: PDF ?
While this is not what you're looking for, perhaps it is an alternate
Sent from my iPad
On Dec 5, 2010, at 10:34 PM, Anthony Howe <anthonyhowe at me.com> wrote:
> Thanks Jan,
> Great to hear the detail around this one. The feature you mention that
you're working on is actually all that we would require and sounds ideal!
> We simply want to 'stamp' an existing document with a customers unique ID
and details. The area of the document to be stamped will be blank space on
each page....at a defined location (footer or header area, for example) and
requires no interaction with the existing content.
> From there, just a re-export of the PDF would be required.
> What do you think?
> On 06/12/2010, at 5:24 PM, Jan Schenkel <janschenkel at yahoo.com> wrote:
>> --- On Sun, 12/5/10, Anthony Howe <anthonyhowe at me.com> wrote:
>>> My question was also not really
>>> around whether PDF export is possible, but rather if it was possible
>>> to open an existing PDF file (which was created in LC, or not) and
>>> add new data (like a personalized footer or header from LC app data
>>> for example), then, reexport it...as a PDF, ready for distribution.
>>> The answer to this one so far seems to be no.....but I'm hoping for
>>> an angle....:)
>>> Hope that clarifies things, and perhaps I should have started a
>>> separate thread on this question, as I accept it does stray somewhat
>>> from the original post.
>> While I have written a library to create new PDF files from scratch, by
script, I'm not sure where to begin taking apart an existing PDF file and
modifying its content.
>> The structure of a PDF file is completely unlike Word DOC or RTF files.
Word processing files are structured around a flow of paragraphs, sentences
and words. PDF files are a set of low-level instructions (draw a line here,
draw this bit of text there, now switch to font 'Times', set the drawing
color to 'red', etc.) and there is no rigid flow structure.
>> More precisely, PDF has no concept of paragraphs - you're at the mercy of
the producing application printing each bit of text in the 'right' order to
ease extraction. In fact, PDF doesn't even have text styling concepts other
than 'font'. You want an underline? Draw it yourself.
>> In fact, it's so complicated that the selection of text in Adobe Reader
or Apple Preview is based on OCR (optical character recognition) algorithms:
we know there's a bit of text here, and that other bit of text has the same
baseline, so that could actually be a single line of text in the user's mind
- let's select both!
>> So if you're looking to read an existing file, and modify the content -
such as replacing placeholder text and expecting the whole flow of the text
to update along with it - you have your work cut out for you.
>> One feature I have been working on, is the ability to open an existing
PDF file, and use pages from it as a background on top of which you draw
additional elements. In that scenario I'm not even really tweaking the
content, and this is presenting its own gotchas...
>> Jan Schenkel.
>> Quartam Reports & PDF Library for LiveCode www.quartam.com
>> "As we grow older, we grow both wiser and more foolish at the same
>> time." (La Rochefoucauld)
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the Use-livecode