PDF Forms

At a recent seminar, Jan Aleman mentioned that it’s possible to use PDF Forms within a solution…

How is this achieved ? Is it through a plug-in ? Has anyone done this that can give me a start ?

Any help or suggestions would be appreciated.

Following snip from earlier thread at http://www.forum.servoy.com/viewtopic.p … t=pdf+plug

Its downloadable in http://forum.servoy.com/viewforum.php?f=1


Jan Blok
Servoy

You may also want to look at http://www.forum.servoy.com/viewtopic.p … t=pdf+plug for more discussion on pdf beans

Regards

Graham Greensall
Worxinfo

Thanks Graham…

Just to clarify…What I’m after is support for pdf forms within Servoy…i.e. user wants to fill in existing pdf forms rather than native Servoy forms. The data entered on the pdf form would then update the DB. How do you bind the pdf form fields to the DB ? They ultimately want to do this via a Headless Client /Browser.

No problem & welcome to Servoy Forum

Think your specific requirement was covered in last two posts of the 2nd Forum link in my post.

Is thier a way to use this bean to add and position text. ie) For instance to programatically fill out a form?

John McCann

No not possible but maybe we could build a merge function for PDF forms based on the lib used by the pdf printer plugin


Jan Blok
Servoy

prob worth contacting servoy support direct if there is a reasonable number of licences at stake :)

Regards

Graham Greensall
Worxinfo

Thanks..will do :D

At the seminar Jan Aleman mentioned the pdf form plugin that we are currently using that allows saving and retrieving of PDF form data. It is a Servoy plugin that has not been “officially” announced yet, but it is not a secret.

You can see a flash movie that shows how it is used in our solution at:

Loading...

This solution has only been tested on the Windows platform. I do not know if the plugin will work on other platforms.

Thanks…Sounds intersting…I’ll take a look.

I just changed the above link to point to a flash movie that shows use of the Servoy PDF form fill-in and save plugin in our solution (instead of continuing to provide a live link to our solution).

I use it to populate fields in PDF forms as follows. It works well.

// First make a PDF form with field names ‘field1_on_the_pdfform’ & ‘field2_on_the_pdfform’
// For me this worked when the form was created with Acrobate Pro 6.0 but not 7.0
// Store the binary of the PDF form in database_field_pdf_binary
var field_values = new Array()
field_values[0] = ‘field1_on_the_pdfform’ + ‘=’ + ‘Pretty’
field_value[1] = field2_on_the_pdfform’ + ‘=’ + ‘Cool’
var pdfform = database_field_pdf_binary
var result_pdf_doc = plugins.pdf_output.convertPDFFormToPDFDocument(pdfform,field_values)
// result_pdf_doc now contains the PDF form with the two field populated with Pretty & Cool

John McCann

Thanks for the suggestion John… :D

The last full beta installer (from the download area in the beta section) contains the pdf output and pdf form plugins. Make sure to check the pdf checkbox when installing. In the solutions/examples directory you will find a pdf form example solution that also contains a brief description on how to use it.

downloaded the installer and did a fresh install

Noticed the following two things:

  • you first need to upgrade the repository
  • the URL’s show only blank pages… am I missing something?

Paul

pbakker:

  • the URL’s show only blank pages… am I missing something?

Paul

do you have acrobat reader 6 installed with the webbrowser plugin?

got Acrobat 6.0 installed

Also a lot of plugins installed, but not one named something like webbrowser. Is that the exact name?

I am able to open PDF’s inside Internet Explorer, though, through other apps…

Trying to see where the issue lies, I thought of turning on the debugger. did so, clikced a button, but the method is executed immediatly, without ability to step through it with the debugger (Note: this is a fresh install!!)

In the console I see nullpointer exceptions.

Paul

That is quite interesting. We did the following on multiple systems:

  1. fresh install of 2.2rc (full installer)
  2. check the pdf checkbox at install
  3. make sure acro 6 or 7 is installed
  4. create a db connection named pdf_forms that points to user_data database
  5. import pdf forms example solution from example directory
  6. create, edit and view forms

In all cases it worked flawlessly. Can you try to follow the exact steps above to see if that gives any problems?

Oddly, now it works… :?

Only thing different between yesterday and today is that yesterday I didn’t create the pdf_forms DB link, but imported it straight into the user_data DB link…

Thought that should also work, wouldn’t it? If so, must have been some bad installation somehow…

Regarding the Debugger now working: If on the pdf_template form with debugger on and you click the View button, the attached mathod is fired completely (it’s only 1 line of code), without being able to step through.

Never noticed that, but when the debugger is on, the first line seems to be executed immediatly.

Paul

The connection name is important yes. Otherwise the service that goes back does not know where to go to. You can configure it in the server admin screens.

I am having some problems with this. I am trying to fill the fields of a pdf form using plugins.pdf_output.convertPDFFormToPDFDocument

I don’t get it to work. What goes wrong is this:

field_values = new Array()
field_values[0] = 'f1-1=' + some_field; //'f1-1=John C.J.'
field_values[1] = 'f1-2=' + some_other_field; //'f1-2=Longlasting'

When I do

field_values = new Array()
field_values[0] = 'f1-1=John C.J.'
field_values[1] = 'f1-2=Longlasting'

it works.

Maybe I am missing something obvious, but I really don’t get it.

Thanks for any help!

Patrick

I did some more testing.

This code

field_values[0] = 'f1-1=John C.J.';

works for me. That means a field called “f1-1” is filled with “John C.J.”.

This code

field_values[0] = 'f1-1=' + 'John C.J.';

doesn’t work!? The field in the PDF is empty.

Could someone please look into this? I see myself currently unable to fill a PDF form with dynamic values not using a servlet…

Thanks
Patrick

Maybe the error is caused by something else?
I checked your code and seems to work fine.

var some_field = "abc";
var some_other_field = "efg";
field_values = new Array()
field_values[0] = 'f1-1=' + some_field; 
field_values[1] = 'f1-2=' + some_other_field;
application.output(field_values[0])
application.output(field_values[1])

RESULT:
f1-1=abc
f1-2=efg

//global script test in crm demo
field_values = new Array()
field_values[0] = 'f1-1=' + forms.companies.company_name;
field_values[1] = 'f1-2=' + forms.companies.companiesid; 
application.output(field_values[0])
application.output(field_values[1])

RESULT:
f1-1=Harrison Ltd
f1-2=3004