FDF files contain data associated with a PDF file. When a PDF contains form field objects, the content (or value) of these objects can be stored in a separate file for transmission to remote server for example.
Since the Version 3.0 of the PDFCreator and the PDF Converter, they support the import of data from FDF files through the Merge method. First the PDF is opened using one of the Open methods of CDINTF, PDFCreativeX or the .NET library. Then the Merge method is called on the FDF file to merge the data into the main pdf.
<Flags()>
Public Enum MERGEOPTIONS As Integer
No_Repeat = 0
Repeat = 1
Above = 2
Layered = 4
End Enum
Public Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"
Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf As ACPDFCREACTIVEX.PDFCreactiveX = New ACPDFCREACTIVEX.PDFCreactiveX()
' Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode)
' Open an existent PDF file
Dim fileName As String = "c:\temp\PDFDocument.pdf"
Dim password As String = ""
pdf.Open(fileName, password)
' Insert the DATA from FDF file
Dim fileNameToMerge As String = "c:\temp\data.fdf"
Dim passwordToMerge As String = ""
pdf.Merge(fileNameToMerge, passwordToMerge, MERGEOPTIONS.No_Repeat)
' Save PDF
pdf.Save("c:\temp\Merged.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)
End Sub
[Flags]
public enum MERGEOPTIONS
{
No_Repeat = 0,
Repeat = 1,
Above = 2,
Layered = 4
}
public void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator Evaluation";
const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initializing PDFCreativeX Object
ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();
// Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode);
// Open an existent PDF file
string fileName = @"c:\temp\PDFDocument.pdf";
string password = "";
pdf.Open(fileName, password);
// Insert the DATA from FDF file
string fileNameToMerge = @"c:\temp\data.fdf";
string passwordToMerge = "";
pdf.Merge(fileNameToMerge, passwordToMerge, (int)MERGEOPTIONS.No_Repeat);
// Save PDF
pdf.Save(@"c:\temp\Merged.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);
}
#include <iostream>
#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace
using namespace std;
enum MERGEOPTIONS
{
No_Repeat = 0,
Repeat = 1,
Above = 2,
Layered = 4
};
int main()
{
// Constants for Activation codes
bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";
bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initialize the COM subsystem
CoInitialize(0);
// IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,
// the type library header file generated by the #import instruction above
IPDFCreactiveXPtr pdf;
// Create the PDFCreactiveX instance
pdf.CreateInstance(__uuidof(PDFCreactiveX));
// set license key
pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));
// Open an existent PDF file
_bstr_t fileName = "c:\\temp\\PDFDocument.pdf";
_bstr_t password = "";
pdf->Open(fileName, password);
// Insert the DATA from FDF file
_bstr_t fileNameToMerge = "c:\\temp\\data.fdf";
_bstr_t passwordToMerge = "";
pdf->Merge(fileNameToMerge, passwordToMerge, MERGEOPTIONS::No_Repeat);
// Save PDF
pdf->Save("c:\\temp\\Merged.pdf", acFileSaveView);
return 0;
}
' Merge Options
Const No_Repeat = 0
Const Repeat = 1
Const Above = 2
Const Layered = 4
' FileSave Constants
Const acFileSaveAll = 0
Const acFileSaveDefault = -1
Const acFileSaveView = 1
Const acFileSaveDesign = 2
Const acFileSavePDFA_7 = 3
Const acFileSavePDFA = 4
Const acFileSavePDF14 = 5
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Creator Evaluation"
Const strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf
Set pdf = CreateObject("PDFCreactiveX.PDFCreactiveX")
' Set license key
pdf.SetLicenseKey strLicenseTo, strActivationCode
' Open an existent PDF file
Dim fileName
fileName = "c:\temp\PDFDocument.pdf"
Dim password
password = ""
pdf.Open fileName, password
' Insert the DATA from FDF file
Dim fileNameToMerge
fileNameToMerge = "c:\temp\data.fdf"
Dim passwordToMerge
passwordToMerge = ""
pdf.Merge fileNameToMerge, passwordToMerge, No_Repeat
' Save PDF
pdf.Save "c:\temp\Merged.pdf", acFileSaveView
' destroy pdf object
Set pdf = Nothing