473,808 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fill form fields in a PDF

Hi there,
I have a PDF that has editable form fileds. I want to be able dynamically
fill in those form fields based on values I provide to the PDF. Right now, I
can create an instance of the object, open the PDF document, but can't get a
handle on the JavaScript portion of the document in order to change any of
the form field values.

Here is a snippet of my code so far:
Type AcroApp = Type.GetTypeFro mCLSID(new
System.Guid("{8 5DE1C45-2C66-101B-B02E-04021C009402}") );

Type AcrobatType = Type.GetTypeFro mCLSID(new
System.Guid("{7 2498821-3203-101B-B02E-04021C009402}") );

Type AcroPD = Type.GetTypeFro mCLSID(new
System.Guid("{F F76CB60-2EC8-101B-B02E-04021C009402}") );

//create instances of the Acrobat objects needed
Acrobat.CAcroAp p oApp = (Acrobat.CAcroA pp) Activator.Creat eInstance(AcroA pp);
Acrobat.CAcroAV Doc avdoc= (Acrobat.CAcroA VDoc)
Activator.Creat eInstance(Acrob atType);
Acrobat.CAcroPD Doc adoc = (Acrobat.CAcroP DDoc)
Activator.Creat eInstance(AcroP D);

avdoc.Open(Serv er.MapPath("pdf s/test.pdf"),"tes t PDF");
adoc = (Acrobat.CAcroP DDoc)avdoc.GetP DDoc();

/* I need to get a hold of the form fields here and fill in their values */

oApp.Show(); //displays the proper PDF
adoc.Close();

Any help would be greately appreciated.

--
Thanks,

John Scott.
Jul 21 '05 #1
2 6628
To be honest, I don't know how to drive PDF.

However, I have a suggestion. When you fill a PDF form and submit it, an
XML stream is sent to the destination of the form. This is how PDF Forms
work (it's very similar to Microsoft Office Infopath, BTW).

So my suggestion is this: if you don't need the customer to see the data in
the form (e.g. you've collected in another way), it may be possible just to
compose the XML stream and submit it to the web server, as though your
program were the acrobat viewer, without ever loading up acrobat.

I hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"John Scott" <jo*******@desp ammed.com> wrote in message
news:2A******** *************** ***********@mic rosoft.com...
Hi there,
I have a PDF that has editable form fileds. I want to be able dynamically
fill in those form fields based on values I provide to the PDF. Right
now, I
can create an instance of the object, open the PDF document, but can't get
a
handle on the JavaScript portion of the document in order to change any of
the form field values.

Here is a snippet of my code so far:
Type AcroApp = Type.GetTypeFro mCLSID(new
System.Guid("{8 5DE1C45-2C66-101B-B02E-04021C009402}") );

Type AcrobatType = Type.GetTypeFro mCLSID(new
System.Guid("{7 2498821-3203-101B-B02E-04021C009402}") );

Type AcroPD = Type.GetTypeFro mCLSID(new
System.Guid("{F F76CB60-2EC8-101B-B02E-04021C009402}") );

//create instances of the Acrobat objects needed
Acrobat.CAcroAp p oApp = (Acrobat.CAcroA pp)
Activator.Creat eInstance(AcroA pp);
Acrobat.CAcroAV Doc avdoc= (Acrobat.CAcroA VDoc)
Activator.Creat eInstance(Acrob atType);
Acrobat.CAcroPD Doc adoc = (Acrobat.CAcroP DDoc)
Activator.Creat eInstance(AcroP D);

avdoc.Open(Serv er.MapPath("pdf s/test.pdf"),"tes t PDF");
adoc = (Acrobat.CAcroP DDoc)avdoc.GetP DDoc();

/* I need to get a hold of the form fields here and fill in their values
*/

oApp.Show(); //displays the proper PDF
adoc.Close();

Any help would be greately appreciated.

--
Thanks,

John Scott.

Jul 21 '05 #2
There is a product called ActivePDF that I have used that does this. There
is a toolkit among other things that is relatively cheap. It has a whole
interface to quickly parse PDF template data.

"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> wrote in message
news:2u******** ************@co mcast.com...
To be honest, I don't know how to drive PDF.

However, I have a suggestion. When you fill a PDF form and submit it, an
XML stream is sent to the destination of the form. This is how PDF Forms
work (it's very similar to Microsoft Office Infopath, BTW).

So my suggestion is this: if you don't need the customer to see the data
in the form (e.g. you've collected in another way), it may be possible
just to compose the XML stream and submit it to the web server, as though
your program were the acrobat viewer, without ever loading up acrobat.

I hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"John Scott" <jo*******@desp ammed.com> wrote in message
news:2A******** *************** ***********@mic rosoft.com...
Hi there,
I have a PDF that has editable form fileds. I want to be able
dynamically
fill in those form fields based on values I provide to the PDF. Right
now, I
can create an instance of the object, open the PDF document, but can't
get a
handle on the JavaScript portion of the document in order to change any
of
the form field values.

Here is a snippet of my code so far:
Type AcroApp = Type.GetTypeFro mCLSID(new
System.Guid("{8 5DE1C45-2C66-101B-B02E-04021C009402}") );

Type AcrobatType = Type.GetTypeFro mCLSID(new
System.Guid("{7 2498821-3203-101B-B02E-04021C009402}") );

Type AcroPD = Type.GetTypeFro mCLSID(new
System.Guid("{F F76CB60-2EC8-101B-B02E-04021C009402}") );

//create instances of the Acrobat objects needed
Acrobat.CAcroAp p oApp = (Acrobat.CAcroA pp)
Activator.Creat eInstance(AcroA pp);
Acrobat.CAcroAV Doc avdoc= (Acrobat.CAcroA VDoc)
Activator.Creat eInstance(Acrob atType);
Acrobat.CAcroPD Doc adoc = (Acrobat.CAcroP DDoc)
Activator.Creat eInstance(AcroP D);

avdoc.Open(Serv er.MapPath("pdf s/test.pdf"),"tes t PDF");
adoc = (Acrobat.CAcroP DDoc)avdoc.GetP DDoc();

/* I need to get a hold of the form fields here and fill in their values
*/

oApp.Show(); //displays the proper PDF
adoc.Close();

Any help would be greately appreciated.

--
Thanks,

John Scott.


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5373
by: Barry Margolin | last post by:
Can I do the following with Javascript? My state has a web site that can be used for online filing for unemployment benefits. Every week I have to go to the site and fill in a form, checking off the same boxes each time. I'd like to automate this. I need to load the URL for the login page into the browser, fill in my username and password, and submit the form. From that page I need to follow a link to file for benefits. There I...
1
2004
by: Tom G | last post by:
Hello, I need some advice on which way to resolve the following. On a form, the user will make a selection from a combo box, after the selection several different fields need to be updated on the form, based on the selection in the combo box. I have been doing this quite successfully by having the combo box rowsource query contain all the fields and simply use the correct column to fill in the text boxes. e.g. me.txtState =...
0
1271
by: tshad | last post by:
MSN has a toolbar that has a Form Fill function that will try to fill form fields on forms when they come up. The problem is that it causes problems with some forms and functions. I found this out this weekend. If you have your address set up in your Form Fill function, any form that has these fields (name, address, city, phone etc) will automatically be filled in. MSN has a toolbar you can download for IE, that is something I am...
5
5797
by: cgian31 | last post by:
I need to access an info page in an external website, normally accessible after filling username and password in a form. I would like to hide this complexity (!) from the user, allowing them to access it through an internal web page (which I would design) maybe with a simple hyperlink. How could I use ASP.NET for designing a webpage that will programmatically fill out two fields (user and password) in a simple html form (through...
2
1416
by: Woody Splawn | last post by:
I have a question about technique with regard to filling drop downs. I have a Winform that has several different tabs and tables associated with it. In an effort to keep the load time small I would like to not fill the fields with lookups at form load time. I have a grid on a tab of this form that has six fields in it that have lookups associated with them. By lookups I mean that the dropDown in the field is populated by doing a query...
2
471
by: John Scott | last post by:
Hi there, I have a PDF that has editable form fileds. I want to be able dynamically fill in those form fields based on values I provide to the PDF. Right now, I can create an instance of the object, open the PDF document, but can't get a handle on the JavaScript portion of the document in order to change any of the form field values. Here is a snippet of my code so far: Type AcroApp = Type.GetTypeFromCLSID(new...
19
3997
by: Alex | last post by:
Hello list This question has probably already been asked, but let me ask again I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
1
2196
by: Kev | last post by:
Hello I have a form (RosterForm) based on a table - RosterRange RosterRange has 4 fields: RosterRangeID Autonumber RosterStartDate Date RosterEndDate Date (probably unnecessary) Ward Text I have 2 unbound combo boxes looking up values - cmbDepartment and
4
4355
by: MichaelK | last post by:
Hello. I have all data already collected on the current page? I want to open another window with the form, fill the fields and submit that form. So basically the question is how can I fill all fields and submit the form on another window. Regards, Michael
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.