PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllCreates an action that loads data from an FDF file into a PDF form.
|
| LONG CreateImportDataAction ( BSTR fileName ) |
Parameters
Return value
Remarks
CreateImportDataAction is an Action category function that allows users to load data into a predefined form in a PDF document from an external FDF file. The function 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 document's actions collection and can be used in AddControlToAction, OpenDocumentAction, PDFANNOTATION_OnBeforeFormatting, PDFANNOTATION_OnChange, PDFANNOTATION_OnKeyPress, PDFANNOTATION_OnSetFocus, PDFANNOTATION_OnLostFocus, PDFANNOTATION_OnMouseDown, PDFANNOTATION_OnMouseUp, PDFANNOTATION_OnMouseEnter, PDFANNOTATION_OnMouseExit, PDFANNOTATION_OnOtherControlChanged, PDFPAGE_SetAction, PDFANNOTATION_Action, PDFOUTLINENODE_Action.
The following example demonstrates form data importing. Click here to download FDF file used (it is ZIP archive with "import.fdf" file). You may unpack it and view using any text editor.
Analogue in new interface: IPDFDocument4::CreateImportDataAction.
Example
{ PDF object is supposed to be created }
PDF.FileName := 'import_test.pdf';
PDF.BeginDoc;
e1 := PDF.PDFPAGE_CreateControl_Edit('field1', 20, 20, 120, 32);
PDF.PDFANNOTATION_Text := 'some text';
e2 := PDF.PDFPAGE_CreateControl_Edit('field2', 140, 20, 240, 32);
PDF.PDFANNOTATION_Text := 'other text';
c1 := PDF.PDFPAGE_CreateControl_Checkbox('check1', 250, 20, 262, 32);
b1 := PDF.PDFPAGE_CreateControl_Button('but1', 20, 60, 80, 80);
PDF.PDFANNOTATION_Caption := 'Reset';
PDF.PDFANNOTATION_OnMouseUp := PDF.CreateResetFormAction();
b2 := PDF.PDFPAGE_CreateControl_Button('but2', 100, 60, 160, 80);
PDF.PDFANNOTATION_Caption := 'Import';
{ See Remarks section to view 'import.fdf' file }
PDF.PDFANNOTATION_OnMouseUp := PDF.CreateImportDataAction('import.fdf');
PDF.EndDoc;
// PDF object is supposed to be created
PDF->FileName = "import_test.pdf";
PDF->BeginDoc();
LONG e1 = PDF->PDFPAGE_CreateControl_Edit("field1", 20, 20, 120, 32);
PDF->PDFANNOTATION_Text = "some text";
LONG e2 = PDF->PDFPAGE_CreateControl_Edit("field2", 140, 20, 240, 32);
PDF->PDFANNOTATION_Text = "other text";
LONG c1 = PDF->PDFPAGE_CreateControl_Checkbox("check1", 250, 20, 262, 32);
LONG b1 = PDF->PDFPAGE_CreateControl_Button("but1", 20, 60, 80, 80);
PDF->PDFANNOTATION_Caption = "Reset";
PDF->PDFANNOTATION_OnMouseUp = PDF->CreateResetFormAction();
LONG b2 = PDF->PDFPAGE_CreateControl_Button("but2", 100, 60, 160, 80);
PDF->PDFANNOTATION_Caption = "Import";
// See Remarks section to view "import.fdf" file
PDF->PDFANNOTATION_OnMouseUp = PDF->CreateImportDataAction("import.fdf");
PDF->EndDoc();
// PDF object is supposed to be created
PDF.FileName = "import_test.pdf";
PDF.BeginDoc();
long e1 = PDF.PDFPAGE_CreateControl_Edit("field1", 20, 20, 120, 32);
PDF.PDFANNOTATION_Text = "some text";
long e2 = PDF.PDFPAGE_CreateControl_Edit("field2", 140, 20, 240, 32);
PDF.PDFANNOTATION_Text = "other text";
long c1 = PDF.PDFPAGE_CreateControl_Checkbox("check1", 250, 20, 262, 32);
long b1 = PDF.PDFPAGE_CreateControl_Button("but1", 20, 60, 80, 80);
PDF.PDFANNOTATION_Caption = "Reset";
PDF.PDFANNOTATION_OnMouseUp = PDF.CreateResetFormAction();
long b2 = PDF.PDFPAGE_CreateControl_Button("but2", 100, 60, 160, 80);
PDF.PDFANNOTATION_Caption = "Import";
// See Remarks section to view "import.fdf" file
PDF.PDFANNOTATION_OnMouseUp = PDF.CreateImportDataAction("import.fdf");
PDF.EndDoc();
' PDF object is supposed to be created
PDF.FileName = "import_test.pdf"
PDF.BeginDoc
e1 = PDF.PDFPAGE_CreateControl_Edit("field1", 20, 20, 120, 32)
PDF.PDFANNOTATION_Text = "some text"
e2 = PDF.PDFPAGE_CreateControl_Edit("field2", 140, 20, 240, 32)
PDF.PDFANNOTATION_Text = "other text"
c1 = PDF.PDFPAGE_CreateControl_Checkbox("check1", 250, 20, 262, 32)
b1 = PDF.PDFPAGE_CreateControl_Button("but1", 20, 60, 80, 80)
PDF.PDFANNOTATION_Caption = "Reset"
PDF.PDFANNOTATION_OnMouseUp = PDF.CreateResetFormAction()
b2 = PDF.PDFPAGE_CreateControl_Button("but2", 100, 60, 160, 80)
PDF.PDFANNOTATION_Caption = "Import"
' See Remarks section to view "import.fdf" file
PDF.PDFANNOTATION_OnMouseUp = PDF.CreateImportDataAction("import.fdf")
PDF.EndDoc
See Also


