The PDF2TIFF function converts a PDF document to a TIFF document.
This method needs special license. Please, contact our Sales Department for more information
long PDF2TIFF(LPCSTR InputFile, LPCSTR Password, LPCSTR OutputFile, long Options, long OptimizeLevel)
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
TIFF generation options. The Options value is a combination of the Image Resolution in the HIWORD and the TIFF Compression Level in LOWORD (Resolution << 16 | Compression).
OptimizeLevel
Optimization level to apply to PDF document before exporting to TIFF.
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. |
Returns True if the document was converted, False otherwise.
These are the values to use for compression:
Compression Level
Value |
Compression Level |
---|---|
0 |
No Compression |
1 |
256 Colors with LZW compression |
2 – 9 |
JPEG Compression |
10 |
CCITT Compression |
Not all Tiff viewers support JPeg compressed Tiff files, TiffFormat 2 to 9 should be used only if the end-user’s viewer supports these formats.
But, there are some predefined values for the Options parameter:
DLL Constants |
Value (Hex) |
Value (Dec) |
Notes |
---|---|---|---|
TIFFOPTION_DEFAULT |
0x012C0000 |
19660800 |
300 DPI, no compression. |
TIFFOPTION_LOW |
0x0096000A |
9830410 |
Low resolution 150 DPI, CCITT compression. |
TIFFOPTION_MEDIUM |
0x012C000A |
19660810 |
300 DPI, CCITT compression. |
TIFFOPTION_HIGH |
0x0258000A |
39321610 |
High resolution 600 DPI, CCITT compression (could be very slow). |
(*) NOTE: Converting from HEX DWORD, unsigned and 32-bit unit of data
When the PDF document consists of multiple pages, one TIFF file is generated for every page with the page index appended to the supplied file name.
See also DocConvertToTIFF or ExportToTIFF.
// 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 TIFF image
LPCSTR passWord = NULL;
long resolution = 300;
long compression = 10;
PDF2TIFF( "c:\\temp\\test.pdf", passWord, "c:\\temp\\test.tiff", resolution << 16 | compression, OPTIMIZE::NO_OPTIMIZATION);
// or
PDF2TIFF( "c:\\temp\\test.pdf", passWord, "c:\\temp\\test2.tiff", TIFFOPTION_MEDIUM, OPTIMIZE::NO_OPTIMIZATION);
return 0;
}