Append, AppendEx, DocAppend

The Append, AppendEx and DocAppend methods append or concatenate a second PDF file to a first one.

 

Syntax

ActiveX:

System.Boolean Append(System.String FileName)
System.Boolean AppendEx(System.Object Document)

DLL:

int DocAppend(EXTDOCHANDLE edhDocument, EXTDOCHANDLE edhSource)

 

Parameters

FileName

Full path of the second PDF file to append to the current one.

Document

Object reference of the second PDF file to append to the current one.

edhDocument

Handle Returned by DocOpen.

edhSource

Hold a reference to the source document.

 

Return Value

The return value is True if the file was appended. If the Append or AppendEx method fails, an exception is raised and there is no return value.

 

Remarks

Append is used when the file to be appended is referenced by its full path. AppendEx is used when the second file was opened using the CDIntf.Document class.

 

Member of CDIntfEx.Document.

Example

Public Sub Sample()

    ' Constants for Activation codes

    Const strLicenseTo As String = "DOCX Converter Developer Evaluation"

    Const strActivationCode As String = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"

 

    ' 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\test.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)

 

    ' Append one document to the first one

    pdfDoc.Append("c:\temp\test1.pdf")

 

    ' Export to DocX

    pdfDoc.ExportToDocX("c:\temp\Appended.docx")

 

    ' Destroy pdfDoc object

    pdfDoc = Nothing    

End Sub

public void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "DOCX Converter Developer Evaluation";

    const string strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190";

 

    // 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\\test.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);

 

    // Append one document to the first one

    pdfDoc.Append("c:\\temp\\test1.pdf");

 

    // Export to DocX

    pdfDoc.ExportToDocX(@"c:\temp\Appended.docx");

 

    // Destroy pdfDoc object

    pdfDoc = null;     

}

// 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  "DOCX Converter Developer Evaluation"

    #define strActivationCode "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"

 

    // Declare a new cdintfex document if it does not exist in the form.

    EXTDOCHANDLE pdfDoc;

 

    // Open the document

    LPBYTE passWord = NULL;

    DocOpenA(&pdfDoc, "c:\\temp\\test.pdf", 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);

 

    // Open the Second document

    EXTDOCHANDLE pdfDoc1;

    DocOpenA(&pdfDoc1, "c:\\temp\\test1.pdf", passWord);

 

    DocAppend(pdfDoc, pdfDoc1);

 

    // Export to DocX

    DocConvertToDOCXA(pdfDoc, "c:\\temp\\Appended.docx", "c:\\temp\\docxsettings.xml", 1);

 

    // Destroy pdfDoc object

    pdfDoc = NULL;    

 

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

import com.jacob.com.Variant;

 

public class Sample {

    public static void main(String[] args)

    {

        // Constants for Activation codes

        String strLicenseTo  = "DOCX Converter Developer Evaluation";

        String strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190";

 

        // 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\\test.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);

 

        // Append one document to the first one

        Dispatch.call(pdfDoc, "Append", "c:\\temp\\test1.pdf");

 

        // Export to DocX

        Dispatch.call(pdfDoc, "ExportToDocX", "c:\\temp\\Appended.docx");

 

        // Destroy pdfDoc object

        pdfDoc = null; 

    }

}

# Constants for Activation codes

$strLicenseTo  =  "DOCX Converter Developer Evaluation"

$strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"

 

#Declare a new cdintfex document if it does not exist in the form.

$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5

 

#Open the document

[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test.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))

 

#Append one document to the first one

[System.__ComObject].InvokeMember('Append', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test1.pdf")

 

#Export to DocX

[System.__ComObject].InvokeMember('ExportToDocX', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\Appended.docx")

 

#Destroy pdfDoc object

$pdfDoc = $null

' Constants for Activation codes

Const strLicenseTo = "DOCX Converter Developer Evaluation"

Const strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"

 

' Declare a new Document object

Dim pdfDoc

Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")

 

' Open the document

pdfDoc.Open "c:\temp\test.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

 

' Append one document to the first one

pdfDoc.Append "c:\temp\test1.pdf"

 

' Export to DocX

pdfDoc.ExportToDocX "c:\temp\Appended.docx"

 

' Destroy pdfDoc object

Set pdfDoc = Nothing