PDFform.dll =========== You can use it with all well known ides (.NET-IDEs, too!) Try it with Visual Basic, VBA, Delphi, C, C++, ... >>> This is the S-H-A-R-E-W-A-R-E version... >>> Try before you buy... >>> And if there're any questions - ask me. >>> Thanks for trying! About installation and working with the dll... ---------------------------------------------- This dll doesn't have an entry point so it's not necessary to register it. Only copying into the system32-directory or in the directory where your application is installed. If you're using vba (from ms access or excel for example) you should declare the functions as private and not public. Using .NET-environments (like MS Visual Studio) it's often better (to avoid stack imbalance errors) to change the parameter-types from longinteger to integer. For the library there is a help-program to test the function immediately: ------------------------------------------------------------------------- H_PDFform.exe As source example there is a delphi-, a vb2005- and vb-project included: ------------------------------------------------------------------------ PDFform_delphi.zip PDFform_vb.zip PDFform_vb2005Express.zip contact: webmaster@pdf-analyzer.com ORDER AT: http://www.pdf-analyzer.com http://www.is-soft.de Ingo Schmoekel - Software-Dev.& Distribution - Zedernstr.30a D-28832 Achim - Uesen GERMANY Kinds of returned (error) codes using the dll with Delphi: ---------------------------------------------------------- 9001 = File not found 9002 = No pdf-file 9003 = No form-fields 9004 = No legal value for "Opt" ( 1 (File), 2 (Clipboard) or 3 (String) ) 9005 = FileName is missing 9006 = FieldName is missing 9007 = FieldContent is missing 9008 = Field doesn't exist 9101 = pdf-form is bigger then 25 mb - no form-field-extraction 1 = For option 1 means filefunction is okay 2 = For option 2 means clipboardfunction is okay Option 3 returns the whole text-string. Kinds of returned (error) codes using the dll with vb(a): --------------------------------------------------------- 2 = For option 1 means filefunction is okay 1 = For option 2 means clipboardfunction is okay Option 3 returns the whole text-string separated by cr/lf. If there isn't a value for a selected formfield nothing will be returned. functions with the type of values and the meaning: -------------------------------------------------- GetPDFffCount, // Get FormFieldCount GetPDFFormFields, // Get FormFields with all relevant data GetPDFFField, // Get a single form field value SetPDFFField, // Set a single form field value function GetPDFffCount(const FileName: PChar): LongInt; stdcall; function GetPDFFormFields(const FileName: PChar; Opt: LongInt): PChar; stdcall; function GetPDFFField(const FileName: PChar; FieldName: PChar): PChar; stdcall; function SetPDFFField(const FileName: PChar; FieldName: PChar; FieldValue: PChar): PChar; stdcall; opt=1 means to extract the form-fields with values of example.pdf to example.pdf.csv (in the same directory). opt=2 means to extract the form-fields with values of a pdf-file to the clipboard. opt=3 means to extract the form-fields with values of a pdf-file as a returning text-string. The generated example.pdf.csv and the clipboard-content have these structure: ----------------------------------------------------------------------------- Filename with directory ; pagenumber ; formfield type ; choicetype ; textflag ; readonly ; printable ; visible ; formfield caption ; subformfield count (next lines the indexes) ; subformfield caption ; formfield title ; formfield value Each line was closed with a sign for carriage return and linefeed. So you can see the clipboard-content in a text-program line by line. Not all atributes are always filled: Subformfield is an example for this. Something about the extracted data: ----------------------------------- A subformfield belongs to choice boxes. For example if you've a formfield with the title cb1 and the type is radio button then you can have three fields. The first one is the normal formfield with the initialized radio button value and the second and third are (for example) subformfields with "yes" and "no". How to set formfield-values: ---------------------------- To change or to set a textformfield-value take the formfield-title as formfield-name and any string as formfield-value. For example "Name1" as formfield-title and "Ingo" as formfield-value. To change or to set a checkbox- or radiobutton-formfield-value take the formfield-title as formfield-name and the subformfield-caption as formfield-value. Sample for delphi: Including the dll in a delphi unit ----------------------------------------------------- program dlltest; uses Forms, dlltest1 in 'dlltest1.pas' {Form1}; . . . unit dlltest1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) OpenDialog1: TOpenDialog; Edit1: TEdit; Button1: TButton; Button2: TButton; Edit2: TEdit; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; function GetPDFffCount(const FileName: PChar): LongInt; stdcall; function GetPDFFormFields(const FileName: PChar; Opt: LongInt): PChar; stdcall; function GetPDFFField(const FileName: PChar; FieldName: PChar): PChar; stdcall; function SetPDFFField(const FileName: PChar; FieldName: PChar; FieldValue: PChar): PChar; stdcall; implementation {$R *.DFM} function GetPDFffCount(const FileName: PChar): LongInt; stdcall; external 'PDFform.dll'; function GetPDFFormFields(const FileName: PChar; Opt: LongInt): PChar; stdcall; external 'PDFform.dll'; function GetPDFFField(const FileName: PChar; FieldName: PChar): PChar; stdcall; external 'PDFform.dll'; function SetPDFFField(const FileName: PChar; FieldName: PChar; FieldValue: PChar): PChar; stdcall; external 'PDFform.dll'; //The file dialog procedure TForm1.Button1Click(Sender: TObject); begin If OpenDialog1.Execute Then Edit1.Text := OpenDialog1.FileName; end; //Get FormfieldCount procedure TForm1.Button2Click(Sender: TObject); var s : LongInt; begin Edit2.Text := ''; Edit2.Text := IntToStr(GetPDFffCount(PChar(Edit1.Text))); end; //Get FormFieldAttributes as String procedure TForm1.Button4Click(Sender: TObject); begin Edit2.Text := ''; Edit2.Text := GetPDFFormFields(PChar(Edit1.Text),3); end; //Get FormFieldAttributes as Clipboardcontent procedure TForm1.Button3Click(Sender: TObject); begin Edit2.Text := ''; Edit2.Text := GetPDFFormFields(PChar(Edit1.Text),2); end; //Get FormFieldAttributes as csv-File procedure TForm1.Button5Click(Sender: TObject); begin Edit2.Text := ''; Edit2.Text := GetPDFFormFields(PChar(Edit1.Text),1); end; //Get the value of a single formfield procedure TForm1.Button6Click(Sender: TObject); begin Edit2.Text := ''; Edit5.Text := GetPDFFField(PChar(Edit1.Text),PChar(Edit3.Text)); end; //Set the value of a single formfield procedure TForm1.Button7Click(Sender: TObject); begin Edit2.Text := ''; Edit2.Text := SetPDFFField(PChar(Edit1.Text),PChar(Edit3.Text),PChar(Edit5.Text)); end; end. Sample for visual basic: Including the dll in a bas-modul module1 ----------------------------------------------------------------- . . . Public Declare Function GetPDFffCount Lib "PDFform.dll" (ByVal Filename As String) As Long Public Declare Function GetPDFFormFields Lib "PDFform.dll" (ByVal Filename As String, ByVal Opt As Long) As String Public Declare Function GetPDFFField Lib "PDFform.dll" (ByVal Filename As String, ByVal FieldName As String) As String Public Declare Function SetPDFFField Lib "PDFform.dll" (ByVal Filename As String, ByVal FieldName As String, ByVal FieldName As String) As String . . . and the button-clicks for each function: . . . Private Sub option1_Click() ' as string Text2.Text = GetPDFFormFields(Text1.Text, 3) End Sub Private Sub Command1_Click() ' as clipboard-content Text2.Text = GetPDFFormFields(Text1.Text, 2) End Sub Private Sub Command2_Click() ' as example.pdf.csv Text2.Text = GetPDFFormFields(Text1.Text, 1) End Sub Private Sub Command3_Click() ' GET a single formfield-value Text2.Text = GetPDFFField(Text1.Text, Text3.Text) End Sub Private Sub Command4_Click() ' SET a single formfield-value Text2.Text = GetPDFFField(Text1.Text, Text3.Text, Text4.Text) End Sub . . .