pdfConvertToTIFF - convert selected pages to multipage TIFF file

<< Click to Display Table of Contents >>

Navigation:  Direct Calls to DLL >

pdfConvertToTIFF - convert selected pages to multipage TIFF file

This method is only available in WPViewPDF "PLUS" in the 32bit edition.

 

This function is exported by the engine DLL to make it easy to convert PDF pages into TIFF  files. No object has to be created and no initialization is required.

 

This function defined as

 

Pascal:

 

fktpdfConvertToTIFF = function(

  filename: PAnsiChar;

   password: PAnsiChar;

   licname, lickey: PAnsiChar; liccode: Cardinal;

   destname: PAnsiChar;

   // filename for created TIFF file

   frompage, to_page: Integer; tiffres: Integer // low word = resolution

   ): Integer; stdcall;

 

filename and destpath are expected to be UTF8 encoded!

 

Better use the "W" function which supports unicode.

 

function pdfConvertToTIFFW(

 filename: PWideChar;

 password: PWideChar;

 licname, lickey: PWideChar; liccode: Cardinal; destname: PWideChar;

 // filename for created TIFF file

 frompage, to_page: Integer; tiffres: Integer // low word = resolution

 ): Integer; stdcall;

 

 

Note: The unit WPViewPDF initializes the function pointers wpview_....

 

C:

 

stdcall int pdfConvertToTIFF(

 char *filename,

 char * password,

 char * licname,

 char * lickey,

 long liccode,

 char * destpath,

 int frompage,

 int to_page,

 int tiffres);

 

VB

 

 Declare Function pdfConvertToTIFF Lib "wPDFViewDemo04.dll" _

                  Alias "pdfMakeJPEG" _

                  (ByVal zfilename As String, _

                   ByVal zpassword As String, _

                   ByVal zlicname As String, _

                   ByVal zlickey As String, _

                   ByVal liccode As Long, _

                   ByVal zdestpath As String, _

                   ByVal frompage As Long, _

                   ByVal To_page As Long, _

                   ByVal tiffres As LongAs Long

 

 

Return Value:

 

The count of converted pages.

 

Parameters:

 

filename: the full path to the input PDF file - please pass a UTF8 string unless you use the "W" function.

 

password: optional user password required to open the PDF file

 

licname, lickey, liccode: when using registered version use your license data here

 

destpath:  the name of the created image file. Note, unlike with pdfMakeImage only one file will be created. Please pass a UTF8 string.

 

frompage: the first exported page, 0 based

 

to_page: the last exported page. (Example: To export the first page uses 0,0 )

 

tiffres: - low-word (0000XXXX): the resolution for the TIFF file (default = 200),

 

hi-word: various options:

 

0 = create a CITTFAX compressed, monochrome TIFF file

1 = create a CITTFAX compressed, monochrome TIFF file without dithering

2 = create a 24 bit LZW compressed TIFF file

 

 

Alternative:

 

function pdfConvertToTIFFW(filename: PWideChar; password: PWideChar;

  licname, lickey: PWideChar;

  liccode: Cardinal;

  destname: PWideChar;//............. filename for created TIFF file

  frompage, to_page: Integer;

  tiffres: Integer // low word = resolution

  ): Integer; stdcall;

 

works like pdfConvertToTIFF but requires unicode instead of UTF8 strings.

 

 

Simple conversion demo in Delphi - uses 2 TEdit:

 

uses ....,WPViewPDF3;

 

{$I PDFLicense.INC}

 

....

 

 

a) in OnCreate load the DLL

procedure TForm2.FormCreate(Sender: TObject);

begin

  WPViewPDFLoadDLL(

     ExtractFilePath(Application.Name) + WPViewPDF_DLLName); // 'wPDFViewPlus04.dll');

end;

 

b) On Button click convert the file

 

procedure TForm2.Button1Click(Sender: TObject);

begin

   if not assigned(wpview_pdfConvertToTIFFW) then

       ShowMessage('wpview_pdfConvertToTIFFW not found')

  else ShowMessage(  'Convert Result=' +

    IntToStr(

     wpview_pdfConvertToTIFFW(

      PWideChar(Edit1.Text),

      '', // password

      PWideChar(WPViewPDF_LicName),

      PWideChar(WPViewPDF_LicKey),

      WPViewPDF_LicCode,

      PWideChar(Edit2.Text),0,10,

      300 // 300 dpi, monochrome

      )));

end;