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
Private Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
' Declare a new cdintfex document if it does not exist in the form.
Dim pdfDoc As New CDIntfEx.Document
' Open the document
pdfDoc.Open("c:\temp\PDFDocument.pdf")
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode)
' Insert the DATA from FDF file
pdfDoc.Merge("c:\temp\data.fdf", MERGEOPTIONS.No_Repeat)
' Save the document
pdfDoc.Save("c:\temp\Merged.pdf")
End Sub
[Flags]
public enum MERGEOPTIONS
{
No_Repeat = 0,
Repeat = 1,
Above = 2,
Layered = 4
}
private void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Converter Evaluation";
const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
// Declare a new cdintfex document if it does not exist in the form.
CDIntfEx.Document pdfDoc = new CDIntfEx.Document();
// Open the document
pdfDoc.Open("c:\\temp\\PDFDocument.pdf");
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode);
// Insert the DATA from FDF file
pdfDoc.Merge("c:\\temp\\data.fdf", (int)MERGEOPTIONS.No_Repeat);
// Save the document
pdfDoc.Save("c:\\temp\\Merged.pdf");
}
// PDF Converter Cpp.cpp : Defines the entry point for the console application.
//
#include <Windows.h>
#include <string>
#include <iostream>
#include "CdIntf.h"
#pragma comment (lib, "CDIntf.lib")
using namespace std;
int main()
{
// Constants for Activation codes
#define strLicenseTo (LPCSTR)"Amyuni PDF Converter Evaluation"
#define strActivationCode (LPCSTR)"07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
// Declare a new cdintfex document if it does not exist in the form.
EXTDOCHANDLE pdfDoc;
EXTDOCHANDLE LetterHead;
// Open the document
LPBYTE passWord = nullptr;
DocOpenA(&pdfDoc, (LPCSTR)"c:\\temp\\PDFDocument.pdf", passWord);
DocOpenA(&dataFile, (LPCSTR)"c:\\temp\\data.fdf", passWord);
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
SetLicenseKeyA(strLicenseTo, strActivationCode);
// Insert the DATA from FDF file
DocMerge(pdfDoc, data.fdf, false, false);
// Save the document
DocSaveA(pdfDoc, (LPCSTR)"c:\\temp\\Merged.pdf");
// Destroy pdfDoc object
DocClose(pdfDoc);
pdfDoc = nullptr;
DocClose(dataFile);
dataFile = nullptr;
return 0;
}
package Example;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Merge {
public enum MERGEOPTIONS
{
No_Repeat (0),
Repeat (1),
Above (2),
Layered (4);
private int value;
private MERGEOPTIONS(int value)
{
this.value = value;
}
public Object value(){
return value;
}
}
public static void main(String[] args)
{
// Constants for Activation codes
String strLicenseTo = "Amyuni PDF Converter Evaluation";
String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
// Declare a new cdintfex document if it does not exist in the form.
ActiveXComponent pdfDoc = new ActiveXComponent("CDIntfEx.Document.6.5");
// Open the document
Dispatch.call(pdfDoc, "Open", "c:\\temp\\PDFDocument.pdf");
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
Dispatch.call(pdfDoc, "SetLicenseKey", strLicenseTo, strActivationCode);
// Insert the DATA from FDF file
Dispatch.call(pdfDoc, "Merge", "c:\\temp\\data.fdf", MERGEOPTIONS.No_Repeat.value);
// Save the document
Dispatch.call(pdfDoc, "Save", "c:\\temp\\Merged.pdf");
}
}
$MERGEOPTIONS = @{
No_Repeat = 0
Repeat = 1
Above = 2
Layered = 4
}
# Constants for Activation codes
$strLicenseTo = "Amyuni PDF Converter Evaluation"
$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
#Declare a new cdintfex document if it does not exist in the form.
$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5
#Open the documents
[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\PDFDocument.pdf")
#The SetLicenseKey method should be called after creating an object of type
#CDIntfEx.Document to activate the advanced methods that require the object
#activation code to work properly
[System.__ComObject].InvokeMember('SetLicenseKey', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @($strLicenseTo, $strActivationCode))
#Insert the DATA from FDF file
[System.__ComObject].InvokeMember('Merge', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @("c:\temp\data.fdf", $MERGEOPTIONS::No_Repeat))
#Save the document
[System.__ComObject].InvokeMember('Save', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\Merged.pdf")
Const No_Repeat = 0
Const Repeat = 1
Const Above = 2
Const Layered = 4
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Converter Evaluation"
Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
' Declare a new cdintfex document if it does not exist in the form.
Dim pdfDoc
Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")
' Open the document
pdfDoc.Open "c:\temp\PDFDocument.pdf"
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey strLicenseTo, strActivationCode
' Insert the DATA from FDF file
pdfDoc.Merge "c:\temp\data.fdf", No_Repeat
' Save the document
pdfDoc.Save "c:\temp\Merged.pdf"