PrintPDFDocumentEx

The PrintPDFDocumentEx function can be used to print a PDF document with password to any standard printer.

 

Syntax

DLL:

BOOL PrintPDFDocumentEx(LPCSTR FileName, LPCSTR Password, LPCSTR PrinterName, long StartPage, long EndPage, long Copies)

 

Parameters

FileName

Full path of PDF file to print.

Password

Password used to open protected PDF file.

PrinterName

Destination printer. If empty, print to the system default printer.

StartPage

Starting page number from which to print.

EndPage

End page number to print.

Copies

Number of copies to print document.

 

Return Value

The return value is True if the document was printed successfully, False otherwise.

 

Remarks

In the case of the evaluation version, only one page at a time can be printed.

If the number of pages is not known and we need to print the whole document, a very large integer can be used for the EndPage parameter. C/C++ developers would typically use MAX_INT (0x7fffffff).

 

Example

// 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"

 

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

 

    // Print Document

    int Pages = 2;

    int copies = 1;

    PrintpdfDocumentEx("C:\temp\\test.pdf", "mypassword", "", 1, Pages, copies); 

 

    return 0;

}