🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.acrobat.reader
3 messages
3 total messages Started by David Dunson Wed, 09 Nov 2005 13:47
Automation Questions
#523
Author: David Dunson
Date: Wed, 09 Nov 2005 13:47
12 lines
1797 bytes
I am an ASP.NET developer and have just been tasked to integrate PDF support 
into my application. Can someone lead me in the right direction on how to 
accomplish the following tasks:

1) Extract form field names and data types from a PDF document.
2) Serve a PDF form to a browser with fields populated from a database.

I'm working with Acrobat 7, PDF version 1.6.  If I can avoid having to read 
the entire 1236 pages of the PDF specification, my life would be a lot 
easier.

Thank you 
Re: Automation Questions
#525
Author: goobamarino
Date: Wed, 09 Nov 2005 22:10
3 lines
1410 bytes
I believe you want the "FDF Toolkit for Windows". It can be used to
display a PDF form and post back to a web server. Maybe something in
there for populating the fields first?
Re: Automation Questions
#526
Author: andreibardin
Date: Thu, 10 Nov 2005 12:33
104 lines
4486 bytes
The following is the standard sample code from Acrobat SDK in C#:
/*ADOBE SYSTEMS INCORPORATED
 Copyright (C) 1994-2004 Adobe Systems Incorporated
All rights reserved.

 NOTICE: Adobe permits you to use, modify, and distribute this file
 in accordance with the terms of the Adobe license agreement
 accompanying it. If you have received this file from a source other
 than Adobe, then your use, modification, or distribution of it
 requires the prior written permission of Adobe.
------------------------------------------------------------

FillFormCS
- This is a simple Acrobat IAC C# sample(C# Console project). It
  includes code to launch Acrobat Viewer, open a PDF file
  (C:\SampleForm.pdf), fill the form field "Name" with value
  "John Doe". The sample leaves the document "SampleForm.pdf" open
  after the application exits on purpose. To keep the pdf document
  open after the application exits, you should utilize the CAcroAVDoc
  class rather than the CAcroPDDoc class.
- The way to set up using Acrobat IAC in the project is from the menu
  Project -> Add References... -> COM to select Acrobat.
- The way to set up using Form IAC in the project is from the menu
  Project -> Add References... -> COM to select "AFormAut 1.0 Type
  Library".
- To run the sample, copy the file "SampleForm.pdf" from the
"FillFormCS"
  folder to C:\.
------------------------------------------------------------*/
using System;
using System.Collections;
using Acrobat;
using AFORMAUTLib;

namespace FillFormCS
{
	/// <summary>
	/// Summary description for FillFormCS.
	/// </summary>
	class FillFormCS
	{
		// Hard-coded file name, it can be changed when needed.
		const string FORM_NAME = "d:\\SampleForm.pdf";
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			// Initialize Acrobat by cretaing App object.
			CAcroApp acroApp = new AcroAppClass();

			// Show Acrobat Viewer
			acroApp.Show();

			// Create an AVDoc object
			CAcroAVDoc avDoc = new AcroAVDocClass();

			// Open the pdf
			if(!avDoc.Open (FORM_NAME, ""))
			{
				string szMsg = "Cannot open" + FORM_NAME + ".\n"
					+ "The program is over.";
				Console.WriteLine(szMsg);
				return;
			}

			// Create a IAFormApp object, so that we can access the form fields
in
			// the open document
			IAFormApp formApp = new AFormAppClass();

			// Get the IFields object associated with the form
			IFields myFields = (IFields)formApp.Fields;

			// Get the IEnumerator object for myFields
			IEnumerator myEnumerator = myFields.GetEnumerator();

			bool bFound = false;

			// Fill the "Name" field with value "John Doe"
			while(myEnumerator.MoveNext())
			{
				// Get the IField object
				IField myField = (IField)myEnumerator.Current;

				// If the field is "Name", set it's value to "John Doe"
				if(myField.Name == "Name")
				{
					bFound = true;
					myField.Value = "John Doe";
					break;
				}
			}

			if(bFound)
				Console.WriteLine("Sucessfully changed the \"Name\" field value to
\"John Doe\".");
			else
				Console.WriteLine("Failed to locate the \"Name\" field in the
form.");
		}
	}
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads