DocConvertToJPEG

The DocConvertToJPEG method converts a PDF document to a JPeg document.

 

This method needs special license.  Please, contact our Sales Department for more information

 

Syntax

DLL:

int DocConvertToJPEG(EXTDOCHANDLE edhDocument, LPCSTR FileName, DWORD Resolution, DWORD QualityLevel)

 

Parameters

edhDocument

Handle Returned by DocOpen.

FileName

Full path of resulting JPeg file(s)

Resolution

This is the resolution of the exported image in dots per inch.  Example: 72, 150, 200, 300, 600.

QualityLevel

JPeg compression level from 1 (highest) to 9 (lowest).

 

Return Value

The return value is zero if the DocConvertToJPEG method succeed. If the DocConvertToJPEG method fails, a negative value will returned.

 

Remarks

When the PDF document consists of multiple pages, one JPeg file is generated for every page with the page index appended to the supplied file name.

 

Optimizing the  document is not recommended when exporting to image formats, it slows down the export and the output might be less accurate.

 

Member of CDIntfEx.Document.

 

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;
 
enum OPTIMIZE 
{
    NO_OPTIMIZATION = 0,
    LINE_OPTIMIZATION = 1,
    PARAGRAPH_OPTIMIZATION = 2,
    TABLE_OPTIMIZATION = 3
};
 
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;
 
    // Open the document
    LPBYTE passWord = NULL;
    DocOpenA(&pdfDoc, (LPCSTR)"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);
 
    // Not to optimize the document to get better results and speed.  This command can be ignored
    DocOptimize(pdfDoc, OPTIMIZE::NO_OPTIMIZATON);
 
    // Export to Jpeg, but the license needs to have that option
    long resolution = 300;
    long compression = 9;
    DocConvertToJPEGA(pdfDoc, (LPCSTR)"c:\\temp\\image.jpg", resolution, compression);
 
    // Destroy pdfDoc object
    DocClose(pdfDoc);
    pdfDoc = nullptr;
 
    return 0;
}