The DocConvertToTIFF method convert a PDF document to a Tiff document.
This method needs special license. Please, contact our Sales Department for more information
int DocConvertToTIFF(EXTDOCHANDLE edhDocument, LPCWSTR FileName, DWORD Resolution, DWORD OutputOptions)
edhDocument
Handle Returned by DocOpen.
FileName
Full path of resulting TIFF file(s).
resolution
This is the resolution of the exported image in dots per inch. Example: 72, 150, 200, 300, 600.
OutputOptions
the TIFF Compression Level.
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.
The return value is zero if the DocConvertToTIFF method succeed. If the DocConvertToTIFF method fails, a negative value will returned.
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 ExportToTIFF or PDF2TIFF.
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.
// 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 TIFF, but the license needs to have that option
long resolution = 300;
long compression = 10;
DocConvertToTIFFA(pdfDoc, (LPCSTR)"c:\\temp\\image.tiff", resolution, compression);
// Destroy pdfDoc object
DocClose(pdfDoc);
pdfDoc = NULL;
return 0;
}