PDF2JPEG

The PDF2JPEG function converts a PDF document to a JPEG document.

 

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

 

Syntax

DLL:

long PDF2JPEG( LPCSTR InputFile, LPCSTR Password, LPCSTR OutputFile, long Options, long OptimizeLevel )

 

Parameters

InputFile

Full path of PDF file to convert to TIFF.

Password

Password, if any, needed to open the PDF file.

OutputFile

Full path of resulting Tiff file.

Options

JPeg generation options. The Options value is a combination of the Image Resolution in the HIWORD and the Jpeg Compression Level (1-9) in LOWORD (Resolution << 16 | Compression).

OptimizeLevel

Optimization level to apply to PDF document before exporting to Jpeg..

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

Optimization Level

Value

Description

No optimization

0

Recommended when exporting to JPEG and Tiff formats.

Line optimization

1

Recommended when exporting to RTF format.

Paragraph optimization

2

Recommended when exporting to HTML format.

Table optimization

3

Recommended when exporting to Excel format.

 

Return Value

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

 

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.

 

 

A JPeg compression level of 0 produces uncompressed 24-bit bitmaps. The file extension should be set to .bmp in this case.

 

 

There are some predefined values for the Options parameter:

DLL Constants

Value

(Hex)

Value

(Dec)

Notes

JPEGOPTION_DEFAULT

0x012C0007

‭19660807‬

300 DPI, JPeg level 7

JPEGOPTION_LOW

0x00960003

‭9830403‬

Low resolution 150 DPI, JPeg level 3

JPEGOPTION_MEDIUM

0x012C0007

‭19660807‬

300 DPI, JPeg level 7

JPEGOPTION_HIGH

0x02580009

39321609

High resolution 600 DPI, JPeg level 9 (could be very slow)

(*) NOTE: Converting from HEX DWORD, unsigned and 32-bit unit of data

 

 

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

 

    // Convert PDF to JPEG image

    LPCSTR passWord = NULL;

    long resolution = 300;

    long compression = 7;

    PDF2JPEG( "c:\\temp\\test.pdf", passWord, "c:\\temp\\test.jpg", resolution << 16 | compression, OPTIMIZE::NO_OPTIMIZATION);

    // or

    PDF2JPEG( "c:\\temp\\test.pdf", passWord, "c:\\temp\\test2.jpg", JPEGOPTION_MEDIUM, OPTIMIZE::NO_OPTIMIZATION);

    return 0;

}