Open

The Open method opens a PDF, Postscript, XPS, or image format like TIFF, PNG or JPEG, files for processing.

 

Syntax

ActiveX:

System.Boolean Open(System.String FileName)

 

Parameters

FileName

Full path of the PDF file to open.

 

Return Value

The return value is True if the file was opened. If the Open method fails, an exception is raised and there is no return value.

 

PDF files protected with password can be opened with OpenEx method.

 

Remarks

To open PDF file with password, check OpenEx Method.

 

Member of CDIntfEx.Document.

 

Example

Public 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

 

    ' 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)

 

    ' Open the document

    pdfDoc.Open("c:\temp\test.pdf")

 

    ' Set AutoBookmarks

    pdfDoc.AutoBookmarks(2, "", 1)

 

    ' Save the document

    pdfDoc.Save("c:\temp\AutoBookmarked.pdf")

End Sub

public void AutoBookmarks()

{

    // 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();

 

    // 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);

 

    // Open the document

    pdfDoc.Open(@"c:\temp\test.pdf");

 

    // Set AutoBookmarks

    pdfDoc.AutoBookmarks(2, "", 1);

 

    // Save the document

    pdfDoc.Save(@"c:\temp\AutoBookmarked.pdf");

}

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  = "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"); 

 

        // 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);

 

        // Open the document

        Dispatch.call(pdfDoc, "Open", "c:\\temp\\test.pdf");

 

        // Set AutoBookmarks

        Dispatch.call(pdfDoc, "AutoBookmarks", 2, "", 1);

 

        // Save the document

        Dispatch.call(pdfDoc, "Save", "c:\\temp\\AutoBookmarked.pdf");

 

        // Destroy pdfDoc object

        pdfDoc = null;

    }

}

# 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

 

#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))

 

#Open the document

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

 

#Set AutoBookmarks

[System.__ComObject].InvokeMember('AutoBookmarks', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,@(2, "", 1)) 

 

#Save the document

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

 

#Destroy pdfDoc object

$pdfDoc = $null

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

' Declare a new Document object

Dim pdfDoc

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

 

' 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

 

' Open the document

pdfDoc.Open "c:\temp\test.pdf"

 

' Set AutoBookmarks

pdfDoc.AutoBookmarks 2, "", 1

 

' Save the document

pdfDoc.Save "c:\temp\AutoBookmarked.pdf"

 

' Destroy pdfDoc object

Set pdfDoc = Nothing

 

Public 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 Postscript document

    pdfDoc.Open("c:\temp\test.ps")

 

    ' 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)

 

    ' Save as PDF document

    pdfDoc.Save("c:\temp\test.pdf")

End Sub

public void AutoBookmarks()

{

    // 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 Postscript document

    pdfDoc.Open(@"c:\temp\test.ps");

 

    // 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);

 

    // Save as PDF document

    pdfDoc.Save(@"c:\temp\test.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  "Amyuni PDF Converter Evaluation"

    #define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

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

    EXTDOCHANDLE pdfDoc;

 

    // Open the Postscript document

    LPBYTE passWord = nullptr;

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

 

    // Save as PDF document

    DocSaveA(pdfDoc, "c:\\temp\\test.pdf");

 

    // Destroy pdfDoc object

    DocClose(pdfDoc);

    pdfDoc = nullptr;       

 

    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  = "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 Postscript document

        Dispatch.call(pdfDoc, "Open", "c:\\temp\\test.ps");

 

        // 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);

 

        // Save as PDF document

        Dispatch.call(pdfDoc, "Save", "c:\\temp\\test.pdf");

 

        // Destroy pdfDoc object

        pdfDoc = null;

    }

}

# 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 Postscript document

[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test.ps") 

 

#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))

 

#Save as PDF document

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

 

#Destroy pdfDoc object

$pdfDoc = $null

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

' Declare a new Document object

Dim pdfDoc

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

 

' Open the Postscript document

pdfDoc.Open "c:\temp\test.ps"

 

' 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

 

' Save as PDF document

pdfDoc.Save "c:\temp\test.pdf"

 

' Destroy pdfDoc object

Set pdfDoc = Nothing

 

Public 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 XPS document

    pdfDoc.Open("c:\temp\test.xps")

 

    ' 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)

 

    ' Save as PDF document

    pdfDoc.Save("c:\temp\test.pdf")

End Sub

public void AutoBookmarks()

{

    // 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 XPS document

    pdfDoc.Open(@"c:\temp\test.xps");

 

    // 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);

 

    // Save as PDF document

    pdfDoc.Save(@"c:\temp\test.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  "Amyuni PDF Converter Evaluation"

    #define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

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

    EXTDOCHANDLE pdfDoc;

 

    // Open the XPS document

    LPBYTE passWord = nullptr;

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

 

    // Save as PDF document

    DocSaveA(pdfDoc, "c:\\temp\\test.pdf");

 

    // Destroy pdfDoc object

    DocClose(pdfDoc);

    pdfDoc = nullptr;  

 

    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  = "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 XPS document

        Dispatch.call(pdfDoc, "Open", "c:\\temp\\test.xps");

 

        // 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);

 

        // Save as PDF document

        Dispatch.call(pdfDoc, "Save", "c:\\temp\\test.pdf");

 

        // Destroy pdfDoc object

        pdfDoc = null;

    }

}

# 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 XPS document

[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test.xps") 

 

#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))

 

#Save as PDF document

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

 

#Destroy pdfDoc object

$pdfDoc = $null

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

' Declare a new Document object

Dim pdfDoc

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

 

' Open the XPS document

pdfDoc.Open "c:\temp\test.xps"

 

' 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

 

' Save as PDF document

pdfDoc.Save "c:\temp\test.pdf"

 

' Destroy pdfDoc object

Set pdfDoc = Nothing