The ExportToTiff method is used to export a PDF document to a single TIFF file.
Sub ExportToTiff(FileName As String, Resolution As Long, TiffFormat As Integer)
void ExportToTiff(string FileName, int resolution, int TiffFormat)
HRESULT ExportToTiff(BSTR FileName, long Resolution, long TiffFormat)
FileName
Name of the file with .tif extension to export to.
Resolution
This is the resolution of the exported image in dots per inch. Example: 72, 150, 200, 300, 600.
TiffFormat
Value |
Description |
---|---|
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.
Optimizing the document is not recommended when exporting to image formats, it slows down the export and the output might be less accurate.
This method uses the PageSequence or PageSecuenceStr attributes from Document Object to determine which pages are going to be exported.
<Flags>
Public Enum OPTIMIZATION_LEVEL
NO_OPTIMIZATION = 0
LINE_OPTIMIZATION = 1
PARAGRAPH_OPTIMIZATION = 2
TABLE_OPTIMIZATION = 3
End Enum
Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"
Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf As ACPDFCREACTIVEX.PDFCreactiveX = New ACPDFCREACTIVEX.PDFCreactiveX()
' Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode)
' Open an existent PDF file
Dim fileName As String = "c:\temp\PDFdocument.pdf"
Dim password As String = ""
pdf.Open(fileName, password)
' Recommended optimization to export the file
Dim level As Integer = OPTIMIZATION_LEVEL.NO_OPTIMIZATION
pdf.OptimizeDocument(level)
' Exporting
Dim outFileName As String = "C:\temp\file.tiff"
Dim resolution As Integer = 300
Dim TiffFormat As Integer = 7
pdf.ExportToTiff(outFileName, resolution, TiffFormat)
End Sub
[Flags]
public enum OPTIMIZATION_LEVEL
{
NO_OPTIMIZATION = 0,
LINE_OPTIMIZATION = 1,
PARAGRAPH_OPTIMIZATION = 2,
TABLE_OPTIMIZATION = 3
}
static void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator Evaluation";
const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initializing PDFCreativeX Object
ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();
// Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode);
// Open an existent PDF file
string fileName = @"c:\temp\PDFdocument.pdf";
string password = "";
pdf.Open(fileName, password);
// Recommended optimization to export the file
int level = (int)OPTIMIZATION_LEVEL.NO_OPTIMIZATION;
pdf.OptimizeDocument(level);
// Exporting
string outFileName = "C:\temp\file.tiff";
int resolution = 300;
int TiffFormat = 7;
pdf.ExportToTiff(outFileName, resolution, TiffFormat);
}
#include <iostream>
#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace
using namespace std;
enum OPTIMIZATION_LEVEL
{
NO_OPTIMIZATION = 0,
LINE_OPTIMIZATION = 1,
PARAGRAPH_OPTIMIZATION = 2,
TABLE_OPTIMIZATION = 3
};
int main()
{
// Constants for Activation codes
bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";
bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initialize the COM subsystem
CoInitialize(0);
// IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,
// the type library header file generated by the #import instruction above
IPDFCreactiveXPtr pdf;
// Create the PDFCreactiveX instance
pdf.CreateInstance(__uuidof(PDFCreactiveX));
// set license key
pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));
// Open an existent PDF file
_bstr_t fileName = "c:\\temp\\PDFdocument.pdf";
_bstr_t password = "";
pdf->Open(fileName, password);
// Recommended optimization to export the file
int level = (int)NO_OPTIMIZATION;
pdf->OptimizeDocument(level);
// Exporting
bstr_t outFileName = "C:\temp\file.tiff";
int resolution = 300;
int TiffFormat = 7;
pdf->ExportToTiff(outFileName, resolution, TiffFormat);
// destroy objects
pdf = NULL;
return 0;
}
' Optimization level
Const NO_OPTIMIZATION = 0
Const LINE_OPTIMIZATION = 1
Const PARAGRAPH_OPTIMIZATION = 2
Const TABLE_OPTIMIZATION = 3
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Creator Evaluation"
Const strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf
Set pdf = CreateObject("PDFCreactiveX.PDFCreactiveX.6.5")
' Set license key
pdf.SetLicenseKey strLicenseTo, strActivationCode
' Open an existent PDF file
Dim fileName
fileName = "c:\temp\PDFdocument.pdf"
Dim password
password = ""
pdf.Open fileName, password
' Recommended optimization to export the file
Dim level
level = NO_OPTIMIZATION
pdf.OptimizeDocument level
' Exporting
Dim outFileName
outFileName = "C:\temp\file.tiff"
Dim resolution
resolution = 300
Dim TiffFormat
TiffFormat = 7
pdf.ExportToTiff outFileName, resolution, TiffFormat
' destroy objects
Set pdf = Nothing