Alaska Software Inc. - reading PDF form fields
Username: Password:
AuthorTopic: reading PDF form fields
Rudolf Reinthalerreading PDF form fields
on Sun, 28 Nov 2010 10:56:24 +0100
Hello,
I would like to read and write form fields (as XML) from and to a PDF 
file. It seems to be possible with the Adobe LiveCycle Designer or with 
the FDFT toolkit. It contains a DLL for such functions. Has anybody 
worked with this things ?
regards
Rudolf
Pablo BotellaRe: reading PDF form fields
on Sun, 28 Nov 2010 16:12:57 +0100
Hi,
>Has anybody  worked with this things ?
QuickPDF allow it , I was made a small task filling PDF fields some years ago. 
you can get the free wrappers from my site
http://news.xbwin.com/newsgroups.php?art_group=ot4xb.examples&article_id=3

And also Hubert was made some work using my wrappers as a base and adding some of his own  stuff, so you have 2 flavours of the same wrappers

Regards,
Pablo Botella
Rudolf ReinthalerRe: reading PDF form fields
on Sun, 28 Nov 2010 18:15:13 +0100
On 28.11.2010 16:12, Pablo Botella wrote:
> Hi,
>> Has anybody  worked with this things ?
> QuickPDF allow it , I was made a small task filling PDF fields some years ago.
> you can get the free wrappers from my site
> http://news.xbwin.com/newsgroups.php?art_group=ot4xb.examples&article_id=3
>
> And also Hubert was made some work using my wrappers as a base and adding some of his own  stuff, so you have 2 flavours of the same wrappers
>
> Regards,
> Pablo Botella
Hello Pablo,
a sample would be helpful. I would like to do the following things:
1. filling formfields in a PDF from xBase++
2. open pdf for editing in xBase++ with ActiveX
3. saving the form with the changed fieldvalues
4. reading the new fieldvalues form the pdf
I will try it with the demoversion of QuickPDF
regards
Rudolf
Rudolf ReinthalerRe: reading PDF form fields
on Sun, 28 Nov 2010 18:47:36 +0100
Hello Pablo,
I get the attached error when starting the test.exe. The only dll 
created is TQuickPDFDLL0719.dll.

regards
Rudolf


------------------------------------------------------------------------------
ERROR LOG of "V:\alaska19\ot4xb\TQuickPDF\test.exe" Date: 11/28/2010 
18:31:54

Xbase++ version     : Xbase++ (R) Version 1.90.331
Operating system    : Windows XP 05.01 Build 02600 Service Pack 3
------------------------------------------------------------------------------
oError:args         :
            -> NIL
oError:canDefault   : N
oError:canRetry     : N
oError:canSubstitute: N
oError:cargo        : NIL
oError:description  : Unable to load QuickPDFDLL0719.dll
oError:filename     :
oError:genCode      :          0
oError:operation    : TQUICKPDF:INIT
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :         -1
oError:subSystem    : TQuickPdf
oError:thread       :          1
oError:tries        :          0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Called from TQUICKPDF:INIT(94)
Called from MAIN(9)
Rudolf ReinthalerRe: reading PDF form fields
on Mon, 29 Nov 2010 09:38:35 +0100
Hello Pablo,
got it working after changing the version in the source.
regards
Rudolf
Rudolf ReinthalerRe: reading PDF form fields
on Mon, 29 Nov 2010 12:39:10 +0100
Hello,
have successful added formfields and checkboxes, can also read the 
content of fields. But I have to problems:

1. when I open the document with Acrobat, I cannot save it with the 
changed field values.

2. The button for sending to localhost:81 works. I am using XB2NET and 
would like to save the form on my webserver, how can I retrieve the 
content from the response to my webserver ?

regards
Rudolf



#include "ot4xb.ch"
//----------------------------------------------------------------------------------------------------------------------
#xcommand \<\<  <str> [, <params,...> ] => cBuffer +=  cPrintf(,<str> [, 
<params> ] )
//----------------------------------------------------------------------------------------------------------------------
proc main()
local oPdf := NIL,x,nFields
TQuickPdf():Register("...key...")
 TQuickPdf():Register("Here The registration Key")
    WITH OBJECT ( oPdf := TQuickPdf():New() )
       ? .:LoadFromFile("test3.pdf")
       nFields := .:FormFieldCount()
       ? nFields
       for x := 1 to nFields
           ? x
           ? .:GetFormFieldCaption(x)
           ? .:GetFormFieldDefaultValue(x)
           ? .:GetFormFieldValue(x)
           ? "-----------------------------------"
*          .:SetFormFieldValue(x,"Test " + ntrim(x))
*          .:SetFormFieldDefaultValue(x,"Test "+ntrim(x))

       next x
       .:SetOrigin(1)
       .:SetPageSize("Letter")
       .:SetMeasurementUnits(2)

       .:addLinktoweb(1,1,1,1,"http://localhost:81",1)
       .:DrawText(1.1,1.5,"Button")

      nNew := .:NewFormField("testbutton",1)  button caption
       .:SetFormFieldCaption(nNew,"Test")
       .:SetFormFieldDefaultValue(nNew,"Inhalt")
       .:SetFormFieldBorderstyle(nNew,0)
       .:SetFormFieldBounds(nNew, 30, 70, 23, 23)
       .:SetFormFieldIcon(nNew,0)
       .:SetNeedAppearances(1)

      nNew := .:NewFormField("testfeld1",1)
       .:SetFormFieldCaption(nNew,"Testfeld")
       .:SetFormFieldDefaultValue(nNew,"Inhalt Feld 1")
       .:SetFormFieldBorderstyle(nNew,0)
       .:SetFormFieldBounds(nNew, .5, .5, .8, .2)
       .:SetFormFieldIcon(nNew,0)
       .:SetNeedAppearances(1)


      nNew := .:NewFormField('Checkbox1', 3)
      .:SetFormFieldCheckStyle(nNew, 2, 1)
      .:SetFormFieldBounds(nNew, .5, .8, .1, .1)
      .:SetFormFieldBorderColor(nNew, 1, 1, 1)
      .:SetFormFieldValue(nNew,"ok")
      .:SetNeedAppearances(1)

       .:SaveToFile("test3.pdf")
       .:Destroy()
    END WITH
inkey(0)
return