These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Looking for a 'Magic Bullet' control

fiveeuros
Registered: Sep 4 2009
Posts: 10

Hello there

I need to develop a Windows application that will allow users to open dynamic PDF forms, view them on-screen and fill the forms with data. The data may be typed in on the form or chosen from a picklist.

The requirement is for a Windows Forms based solution developed in VB.Net, so ideally I would be looking for a control that I can drop on to a Windows form in Visual Studio.

Given the project requirements, it is vital that the control is capable of all of the following:

- Open PDF forms in a windows application
- Respond to click events in the individual editable form fields
- Allow both user-based and code-based update of form fields
- Allow saving of partially completed PDF forms for later completion
- Support JavaScript within a PDF form

I've tried a good few things and the closest I have so far are:
- Adobe's own control; this doesn't appear to respond to click events from the individual fields within a form when it is displayed, and I also couldn't see how to progrmatically set form field values.
- O2Solutions PDFView4Net control; this however doesn't support Javascript or appear to allow partially filled forms to be saved.

I'm tearing my hair out over this one...

I appreciate your help,
fiveeuros

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You've got two completely different things here.
1. A PDF viewer that can be embedded into a Windows application
2. A PDF form that the user fills out.

Don't confuse them. In many ways these two things are unrelated. Or a better way to think about it is that they don't talk to one another in any kind of direct way. The PDF form lives in it's own little world and does it's thing and the viewer lives in it's world and does it's own thing. The viewer can open and close PDF files but thats about the only feature you can control programatically from the outside world. Obviously this isn't quite true, but you'll be happier if you don't push these limits.

That said, the only viewer that will support the kind of form interactivity (i.e. JavaScript) that you want is the Acrobat ActiveX Object. This viewer is really just a window into the real viewer (Acrobat or Reader), which the user has to have on thier system. And it supports everything Acrobat supports. I don't know why it wasn't responding to mouse events. I've used it in a VB program and didn't have a problem.

This ActiveX Object also supports a message passing protocal between JavaScript in a PDF and whatever is controling the ActiveX Object. So you can set PDF field values from the VB program, but to do it the PDF has to be setup to specifically handle the messages. And your VB program has to implement the proper protocal. I don't remeber what the name of this protocal is but I wouldn't try to implement it. There is another way. This ActiveX object is the same one that the browser uses and the message passing protocal is the same one used by browsers to talk to stuff loaded into an HTML Object tag. So here's my suggestion. Use the HTML viewer in your VB program. Have it load an HTML page that contains the scripting and the object tag for loading your PDF. When you need to load a new PDF just load another HTML page.

Ok, here's another idea. PDFs, through Acrobat/Reader, can talk to a server. You're VB program could easily contain a local server. All it has to do is listen on some odd socket number. Then you can setup the PDF to trade data with the VB program through the server.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

fiveeuros
Registered: Sep 4 2009
Posts: 10
Thom

I appreciate the response. It looks like there is going to be a lot more work in this than I anticipated.

Just to give you a little more background on why I am looking for a control that has all of the described functionality:

I'm upgrading an existing project from VB6 to .Net, with a requirement for like-for-like functionality. Users dislike change I guess.

The original project contained a control (JetForm FormFlow) that included all of the required functionality. As I understand it, JetForm was eventually acquired by Adobe, and the FormFlow software was officially end-of-lifed in 2004.

I've tried using the original FormFlow control (from FormCtl.dll) in the upgraded project, but it is not compatible with Visual Studio 2008 [edit: it's also not compatible with VS 2005] (not a huge surprise given that it predates VS by several years).

I guess I just find it surprising that in 2004 there was a control that offered everything that I need, but here we are 5 years later and there's now nothing that suits. Progress, huh?

Thanks again
fiveeuros
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ok, that makes sense. The Jet Forms people created a much tighter integration between thier viewer and the containing application. However, Jet Forms are not ubiquitous throughout the world, PDFs are. There was never a fear that someone would use a JetForm to spread a virus. We live in a much scarier world now and this is a constant fear at Adobe. Therefore Acrobat is locked down a bit tighter. Just like people in small towns no longer leave thier front doors unlocked, and you can't just walk onto an airplane, its just not safe anymore. So in fact its not suprising at all that you would loose functionality to security concerns:(

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script