PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllThis method creates an action that loads data from an FDF file into a PDF form.
|
| LONG CreateImportDataAction ( BSTR fileName ) |
Parameters
Return value
Remarks
This method creates an action that allows users to load data into a predefined form in a PDF document from an external FDF file. The method creates a JavaScript action. The structure of an FDF file can be found in the Adobe PDF Reference (8.6.6 Forms Data Format).
The return value is an action identifier in the document's actions collection and can be used in OnOpenDocument, OnControlMouseDown and other OnAnnot* properties (see Annotations).
The following example demonstrates form data importing. Click here to download the FDF file used. (It is ZIP archive containing the "import.fdf" file). You may unpack it for viewing with any text editor.
Example
{ PDF object is supposed to be created }
e1 := PDF.AddEditBox(20, 20, 120, 32, 'field1');
PDF.AnnotUnicodeText := 'some text';
e2 := PDF.AddEditBox(140, 20, 240, 32, 'field2');
PDF.AnnotUnicodeText := 'other text';
c1 := PDF.AddCheckBox(250, 20, 262, 32, 'check1');
b1 := PDF.AddButton(20, 60, 80, 80, 'but1');
PDF.AnnotUnicodeCaption := 'Reset';
PDF.OnControlMouseUp := PDF.CreateResetFormAction();
b2 := PDF.AddButton(100, 60, 160, 80, 'but2');
PDF.AnnotUnicodeCaption := 'Import';
{ See Remarks section to view "import.fdf" file }
PDF.OnControlMouseUp := PDF.CreateImportDataAction('import.fdf');
PDF.SaveToFile('import_test.pdf', true);
// PDF object is supposed to be created
long e1 = PDF->AddEditBox(20, 20, 120, 32, "field1");
PDF->AnnotUnicodeText = L"some text";
long e2 = PDF->AddEditBox(140, 20, 240, 32, "field2");
PDF->AnnotUnicodeText = L"other text";
long c1 = PDF->AddCheckBox(250, 20, 262, 32, "check1");
long b1 = PDF->AddButton(20, 60, 80, 80, "but1");
PDF->AnnotUnicodeCaption = L"Reset";
PDF->OnControlMouseUp = PDF->CreateResetFormAction();
long b2 = PDF->AddButton(100, 60, 160, 80, "but2");
PDF->AnnotUnicodeCaption = L"Import";
// See Remarks section to view "import.fdf" file
PDF->OnControlMouseUp = PDF->CreateImportDataAction("import.fdf");
PDF->SaveToFile("import_test.pdf", true);
// PDF object is supposed to be created
long e1 = PDF.AddEditBox(20, 20, 120, 32, "field1");
PDF.AnnotUnicodeText = "some text";
long e2 = PDF.AddEditBox(140, 20, 240, 32, "field2");
PDF.AnnotUnicodeText = "other text";
long c1 = PDF.AddCheckBox(250, 20, 262, 32, "check1");
long b1 = PDF.AddButton(20, 60, 80, 80, "but1");
PDF.AnnotUnicodeCaption = "Reset";
PDF.OnControlMouseUp = PDF.CreateResetFormAction();
long b2 = PDF.AddButton(100, 60, 160, 80, "but2");
PDF.AnnotUnicodeCaption = "Import";
// See Remarks section to view "import.fdf" file
PDF.OnControlMouseUp = PDF.CreateImportDataAction("import.fdf");
PDF.SaveToFile("import_test.pdf", true);
' PDF object is supposed to be created
e1 = PDF.AddEditBox(20, 20, 120, 32, "field1")
PDF.AnnotUnicodeText = "some text"
e2 = PDF.AddEditBox(140, 20, 240, 32, "field2")
PDF.AnnotUnicodeText = "other text"
c1 = PDF.AddCheckBox(250, 20, 262, 32, "check1")
b1 = PDF.AddButton(20, 60, 80, 80, "but1")
PDF.AnnotUnicodeCaption = "Reset"
PDF.OnControlMouseUp = PDF.CreateResetFormAction()
b2 = PDF.AddButton(100, 60, 160, 80, "but2")
PDF.AnnotUnicodeCaption = "Import"
' See Remarks section to view "import.fdf" file
PDF.OnControlMouseUp = PDF.CreateImportDataAction("import.fdf")
PDF.SaveToFile "import_test.pdf", true
See Also


