PDF to TIFF COM
     
   Overview  
   Intallation&Uninstallation  
   System requestment  
   Getting started
  • Using in Borland Delphi 7
  • Using in Visual Basic 6
  • Using in Visual C++ 6
  • Using in .NET
  • Using in ASP
     
       SDK/COM reference.
  • Methods
  • Properties
  • Constants
     
       How to ...
  • How to create multipages tiff images?
  • How to create memory stream images?
  • How to increase/decrease the file size of an image?
     
       Registration  
       Copyright&License  
     1. Overview
     

    Pdf to Tiff SDK/COM is a powerful pdf sdk/com, it produces fully functional tiff documents with text, pictures, graphics etc, using the original pdf document formatting. It does not need any software support, such as Adobe Acrobat, Acrobat Reader, etc.
    Pdf to Tiff SDK/COM supports multifarious compression mode of tiff image, supports to select individual pages for conversion, supports multipages tiff and CCITT fax image files.
    Pdf to Tiff SDK/COM supports some reasonable function interfaces. It can be easily used to VC/VB/.NET/C++Builder/Delphi and other development platforms. The client or server license is required for application development, using client or server license you can integrate the sdk/com into your application.

     
          The primary functions are listed following.
    (01)  It quickly convert pdf document to image document.
    (02)  It supports CCITT fax image files.
    (03)  It supports encrypted pdf file.
    (04)  It supports to select individual pages for conversion.
    (05)  It supports conversion of vector graphics into image files.
    (06)  It supports to generate multipage tiff files.
    (07)  It supports any resolution in the generated image files.
    (08)  It supports conversion into color 1bit, 4bits, 8bits,4bits grayscale, 8tits grayscale and 24bits per pixel format image.
    (09)  It supports multifarious compression of tiff image, such as LZW, JPEG, PACKBITS, CCITT Group3, CCITT Group4, RLE etc.
    (10)  It allows you to preserve original document layout.
    (11)  It supports windows 2000/xp/2003/vista and windows 7 platform.
    (12)  It does not require Adobe Acrobat or Reader support.
    (13)  It supports Adobe Acrobat 3.0, 4.0, 5.0, 6.0 compatibility.

     2. Installation&Uninstallation
      (1) Installation PDF to IMAGE COM

      The PDF to TIFF SDK/COM is a zip archive,which contains various files including runtime binary executable codes, developer's samples and documents,and license file etc.
    You can unzip the archive using a tool like WinZip or WinRAR.
    The archive contians the following subdirectories.
      bin:  It contians the runtime binary executable codes.
      doc:  It contians the user's manuals and license file.
      include:   It contians header files which included in your vc,c++builder,delphi or other development platforms.
      samples:   It contians vc,vb,c++builder,delphi,c#,vb.net,asp and asp.net sample programes and so on.
     
      step 1. Copy the files pdf2tiff.dll and pdf2tiff.ocx,which placed at the archive's subdirectory 'bin', to windows system directory.
      for example
              。copy pdf2tiff.dll c:\windows\system
              。copy pdf2tiff.ocx c:\windows\system

      step 2. Register the component pdf2tiff.ocx in your system using the regsvr32 program that is provided with the windows operating system.
      for example
              。regsvr32 pdf2tiff.ocx

     3. System requestment

         Supported Operation Systems  
         The following operation systems listed have been tested with PDF to TIFF COM and are officially supported.  
          (1) Microsoft Windows 2000 Professional;
          (2) Microsoft Windows 2000 Server and Advanced Server;
          (3) Microsoft Windows 2003 Server 32-bit Web Edition, Standard Edition and Enterprise Edition;
          (4) Microsoft Windows XP Professional and Home Edition;
          (5) Microsoft Windows Vista Ultimage and Home Edition;
          (6) Microsoft Windows 7.

         Recommended hardware  
          (1) CPU: Intel(or Standard PC) 800MHz or faster compatible x86 processor;
          (2) RAM: 256MB or more RAM recommended, 128MB minimum;
          (3) Hard-disk: 100MB free space recommended, 50MB free space required;

     4. Getting Started
      (1) Using PDF to TIFF SDK/COM in Delphi 7
      This section describes how to use PDF to TIFF SDK/COM quickly on Borland Delphi 7, after installing and registering the SDK/COM component.
      

      step 1.   Install the component on Borland Delphi 7
      Once the component is registered successful, start your delphi application.
  • Go to the menu 'Component' and select the item 'Import ActiveX Control...', then it shows the following window.



  • The component 'AP Pdf2Tiff ActiveX Control Type Library' shows up in the list, select it.

  • The class 'TAxPdf2Tiff' should be listed now.You can select any one of the palette pages if you like, the default is page 'ActiveX'.

  • Clicking the button 'Install...' to import the component.



  • To select the existing or new package to add the class 'TAxPdf2Tiff', default the class is added to the existing package '$(DELPHI7)\Lib\dclusr.dpk'. Keeping default option, clicking the button 'OK' to add the class.

  • The next it shows the 'Confirm' dialog, then click the button 'Yes' to rebuilt the package.

  • After the component is registered, it shows the following dialog, click button 'OK' to close the dialog.



  • The last, you can check the page 'ActiveX', the component has been imported successful. It looks like the following.


  •   step 2.   Creating a application project.
      Creating a new Standard-Exe delphi project, then save the project to the directory which you like.

      step 3.   Drawing a new button and coding the click event.
      Drawing a new command button(and rename it if you like) so that you have something similar to this:



    Then double clik the button 'demo1' and code it looks like the following:

    procedure TForm1.btnDemo1Click(Sender: TObject);
    var
       sFileName: String;
       AxPdf2Tiff: TAxPdf2Tiff;
       nHandle: Integer;
    begin
       sFileName := 'd:\\sample1.pdf';

       AxPdf2Tiff := TAxPdf2Tiff.Create(nil);
       nHandle := AxPdf2Tiff.apOpen(WideString(sFileName),'','');
       case nHandle of
          ERR_OVER_MAXTHREADS:
              begin ShowMessage('Over the limit amount of threads,please waiting!'); exit; end;
          ERR_FILE_UNEXIST:
              begin ShowMessage('Source pdf file unexist!'); exit; end;
          ERR_FILE_DAMAGED:
              begin ShowMessage('Source pdf file damaged!'); exit; end;
          ERR_FILE_RESTRICTED:
              begin ShowMessage('Source pdf file restricted!'); exit; end;
       end;

       AxPdf2Tiff.apConvert(nHandle);
       AxPdf2Tiff.apClose(nHandle);
       AxPdf2Tiff.Free;
    end;
      Notice: For more detial, please see the Delphi sample which is included in samples/Delphi.

      (2) Using PDF to TIFF SDK/COM in Visual Basic 6
      This section describes how to use PDF to TIFF SDK/COM quickly in Visual Basic, after installing and registering the SDK/COM component.
      

      step 1.   Creating a application project.
      The first, creating a new Standard-Exe Visual Basic project, then save the project to the directory which you like.

      step 2.   Adding the component to the project.
     
  • Opening the menu 'Porject' and select the item 'References...', it show the following window.



  • Clicking the button 'Browse...', it show the open dialog, here you must select the file 'pdf2tiff.ocx' which installed at windows system directory, just then it show the following window.



  • Selecting the 'AP Pdf2Tiff ActiveX Control Type Library' component and click the button 'OK'.

  •   step 3.   Drawing a new button and coding the click event.
      Drawing a new command button(and rename it if you like) so that you have something similar to this:



    Then double clik the button 'demo1' and code it looks like the following:

    Private Sub Command1_Click()
       Dim AxPdf2Tiff As New AP_PDF2TIFF.AxPdf2Tiff
       Dim nHandle As Long
       Dim sFileName As String

       sFileName = "d:\\sample1.pdf"
       nHandle = AxPdf2Tiff.apOpen(sFileName, "", "")
       Select Case nHandle
          Case ERR_OVER_MAXTHREADS
                MsgBox "Over the limit amount of threads,please waiting!"
                Exit Sub
          Case ERR_FILE_UNEXIST
                MsgBox "Source pdf file unexist!"
                Exit Sub
          Case ERR_FILE_DAMAGED
                MsgBox "Source pdf file damaged!"
                Exit Sub
          Case ERR_FILE_RESTRICTED
                MsgBox "Source pdf file restricted!"
                Exit Sub
       End Select

       AxPdf2Tiff.apConvert nHandle
       AxPdf2Tiff.apClose nHandle
    End Sub

      Notice: For more detial, please see the VB sample which is included in samples/VB.

      (3) Using PDF to TIFF SDK/COM in Visual C++ 6
      This section describes how to use PDF to TIFF SDK/COM quickly in Visual C++, after installing and registering the SDK/COM component.
      

      step 1.   Creating a application project.
      The first, creating a new Standard-Exe Visual C++ project, then save the project to the directory which you like.

      step 2.   Adding the component to the project.
     
  • Opening the menu 'Porject' and select the item 'Add To Project -> Compenents and Controls...', it shows the 'Components and Controls Gallery' window.

  • Double click the folder 'Registered ActiveX Controls ', All activex controls which have been registered in the operating system show up in the list.

  • Selecting the item 'AP Pdf2Tiff ActiveX Control Type Library' and click the button 'Insert', it looks like the following picture.



  • Clicking the button 'OK' to add the component in the sure dialog.

  • To cancel the checkbox 'COleFont' and click the button 'OK' to add the component to your vc project.



  • The last step is to close the 'Components and Controls Gallery' window directly.

  •   step 3.   Drawing a new button and coding the click event.
      Drawing a new command button(and rename it if you like) so that you have something similar to this:



    Then double clik the button 'demo1' and code it looks like the following:

    //Demo1 - To convert all pages of the pdf document.
    void CDemo_vcDlg::OnButtonDemo1()
    {
          // TODO: Add your control notification handler code here
          long nHandle;
          char sFileName[] = "sample.pdf";

          //Creating and Loading AP Pdf2Tiff ActiveX Control object.
          CAxPdf2Tiff m_AxPdf2Tiff;
          m_AxPdf2Tiff.Create("_AxPdf2Tiff",WS_CHILD,CRect(0,0,0,0),this,12345);

          //Open pdf document and creating a converter.
          nHandle = m_AxPdf2Tiff.apOpen(sFileName,NULL,NULL);
          switch( nHandle ){
                case ERR_OVER_MAXTHREADS:{
                      MessageBox("Over the limit amount of threads,please waiting!","demo",MB_OK);
                      return;
                }
                case ERR_FILE_UNEXIST:{
                      MessageBox("Source pdf file unexist!","demo",MB_OK);
                      return;
                }
                case ERR_FILE_DAMAGED:{
                      MessageBox("Source pdf file damaged!","demo",MB_OK);
                      return;
                }
                case ERR_FILE_RESTRICTED:{
                      MessageBox("Source pdf file restricted!","demo",MB_OK);
                      return;
                }
          }

          //To convert all pages of the pdf document.
          long iPageCount = m_AxPdf2Tiff.apGetPageCount(nHandle);
          for(int iPageNo = 1; iPageNo <= iPageCount; iPageNo++)
                m_AxPdf2Tiff.apConvertPage(nHandle,iPageNo);

          //Close pdf document and destory the converter.
          m_AxPdf2Tiff.apClose(nHandle);
    }
      Notice: For more detial, please see the VC sample which is included in samples/VC.

      (4) Using PDF to TIFF SDK/COM in .NET 2003
      This section describes how to use PDF to TIFF SDK/COM quickly in .Net 2003, after installing and registering the SDK/COM component.
      

      step 1.   Creating a application project.
      The first, creating a new Standard-Exe Visual Basic(or c#) .NET project and saving the project to the directory which you like.

      step 2.   Adding the component to the project.
     
  • Opening the menu 'Porject' to select the item 'Add References...', it shows the 'Add Reference' window.

  • Clicking the 'COM' tag and selecting the 'AP Pdf2Tiff ActiveX Control Type Library' component as shown in the image below.



  •   step 3.   Drawing a new button and coding the click event.
      Drawing a new command button(and rename it if you like) so that you have something similar to this:



    Then double clik the button 'demo1' and code it looks like the following:

    Private Sub btnDemo1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDemo1.Click
       Dim AxPdf2Tiff As New AP_PDF2TIFF.AxPdf2Tiff
       Dim nHandle As Integer
       Dim sFileName As String

       sFileName = "d:\\sample1.pdf"
       nHandle = AxPdf2Tiff.apOpen(sFileName, "", "")
       Select Case nHandle
          Case ERR_OVER_MAXTHREADS
                MsgBox("Over the limit amount of threads,please waiting!")
                Exit Sub
          Case ERR_FILE_UNEXIST
                MsgBox("Source pdf file unexist!")
                Exit Sub
          Case ERR_FILE_DAMAGED
                MsgBox("Source pdf file damaged!")
                Exit Sub
          Case ERR_FILE_RESTRICTED
                MsgBox("Source pdf file restricted!")
                Exit Sub
       End Select

       AxPdf2Tiff.apConvert(nHandle)
       AxPdf2Tiff.apClose(nHandle)
    End Sub

      Notice: For more detial, please see the VB.NET(or C#.NET) sample which is included in samples/VB.NET2003(or samples/CShare.NET2003).

      (5) Using PDF to TIFF SDK/COM in ASP
      This section describes how to use PDF to TIFF SDK/COM quickly on ASP, after installing and registering the SDK/COM component.
    The class name of the PDF to IMAGE SDK/COM is Pdf2TiffCOM.pdf2tiff.
      

      The following is a ASP sample.
      <%
    '-----------------------------------------------------------------------------------------------------------------------------
       Call doMain()
    '-----------------------------------------------------------------------------------------------------------------------------
       sub doMain()
          'Create com object.
          Set AxPdf2Tiff = Server.CreateObject("Pdf2TiffCOM.pdf2tiff")

          'Open pdf file and creating a converter.
          'It return a handle of the created converter.

          sPdfFile = "d:\\sample1.pdf"
          nHandle = AxPdf2Tiff.apOpen(sPdfFile,"","")
          Select Case nHandle
                Case ERR_OVER_MAXTHREADS
                      Response.write "Open '"+sPdfFile+"' failure - Over the limit amount of threads,please waiting!<br>"
                      exit sub
                Case ERR_FILE_UNEXIST
                      Response.write "Open '"+sPdfFile+"' failure - Source pdf file unexist!<br>"
                      exit sub
                Case ERR_FILE_DAMAGED
                      Response.write "Open '"+sPdfFile+"' failure - Source pdf file damaged!<br>"
                      exit sub
                Case ERR_FILE_RESTRICTED
                      Response.write "Open '"+sPdfFile+"' failure - Source pdf file restricted!<br>"
                      exit sub
          End Select
          Response.write "Open '"+sPdfFile+"' ok!<br>"

          'Setting properties.
          'For more,please refer to user manual.
          AxPdf2Tiff.sOutDirectory = "d:\\demo1"    'output directory
          AxPdf2Tiff.iXDPI = 120    'horizontal dpi
          AxPdf2Tiff.iYDPI = 120    'vertical dpi

          iPageCount = AxPdf2Tiff.apGetPageCount(nHandle)
          Response.write "The Amount of the pdf pages is "+cstr(iPageCount)+".<br>"

          'To convert the pdf file.
          For iPageNo = 1 to iPageCount
                Response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converting the page "+cstr(iPageNo)+"......<br>"
                AxPdf2Tiff.apConvertPage nHandle,iPageNo
          Next

          'Close pdf file and destory the converter.
          AxPdf2Tiff.apClose nHandle
          Response.write "Close '"+sPdfFile+"' ok!<br>"
       end sub
    %>
      Notice: For more detial, please see the ASP sample which is included in samples/ASP.

     5. SDK/COM reference
      (1) Methods
      This section describes client sdk interfaces detailedly.
      。 Method --- apOpen()
      This method opens a pdf file, if the pdf file is restricted, you can ensure owner password or user password. After it opens success, it will create a converter and return the converter's handle.
      Syntax
      long apOpen(char *pPdfFileName, char *pOwnerPw, char *pUserPw);
      Parameters
      pPdfFileName:   Source pdf file name. It supports absolute path and relative path.
      pOwnerPw:  Pdf owner password.
      pUserPw:   Pdf user password.
      Return value
      If the function succeeds, it returns a converter's handle. If the function fail, it returns a error code, such as the following, for more error codes, please click here.
      ERR_OVER_MAXTHREADS: Over the limit amount of threads.
      ERR_FILE_UNEXIST: Source pdf file unexist.
      ERR_FILE_DAMAGED: Source pdf file is damaged, or not a correct pdf file.
      ERR_FILE_RESTRICTED: Source pdf file is restricted, such as password is wrong etc.
     
      。 Method --- apClose()
      This method close the pdf file and destroy the converter appointed by the handle.
      Syntax
      long apClose(long nHandle);
      Parameters
      nHandle:  The converter's handle, which created by method---apOpen.
      Return value
      It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
     
      。 Method --- apConvert()
      This method converts all pages of the pdf file.
      Syntax
      long apConvert(long nHandle);
      Parameters
      nHandle:  The converter's handle, which created by method---apOpen.
      Return value
      It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
     
      。 Method --- apConvertPage()
      This method converts a certain page of the pdf file, the page appointed by the second parameter---nPageNo.
      Syntax
      long apConvertPage(long nHandle,long nPageNo);
      Parameters
      nHandle:  The converter's handle, which created by method---apOpen.
      nPageNo:  A certain page of the pdf file, which will be converted.
      Return value
      It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
     
      。 Method --- apConvertPageToStream()
      This method converts a certain page of the pdf file to memory stream, the page appointed by the second parameter---nPageNo.
      Syntax
      long apConvertPageToStream(long nHandle,
                                               long nPageNo,
                                               BYTE *&pMemStream,
                                               long &nSize);
      Parameters
      nHandle:  The converter's handle, which created by method---apOpen.
      nPageNo:  A certain page of the pdf file, which will be converted.
      pMemStream: A pointer of memory stream, which point to result image's memory stream.
      nSize: It is the size of memory image stream.
      Return value
      It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
      Notice: The result image's memory stream managed by the sdk automatically, you need not to allocate or destory it manually. If this method is invoked successful, the properties iStreamHandle and iStreamSize become valid right now. The property iStreamHandle shows the handle of memory stream of the image which are previously saved using apConvertPageToStream(), and the property iStreamSize shows the size of the stream in byte.
     
      。 Method --- apGetPageCount()
      This method is to get the number of pages in the PDF document.
      Syntax
      long apGetPageCount(long nHandle);
      Parameters
      nHandle:  The converter's handle, which created by method---apOpen.
      Return value
      If the method works successful, it returns the number of pages in the PDF document, otherwise the method works failure. For more error codes, please click here.
     
      。 Method --- apGetPageWidth()
      This method is to get the width of a pdf page. Afert the method apConvertPage() or apConvertPageToStream() is invoked successful, this method becomes valid.
      Syntax
      long apGetPageWidth( long nHandle);
      Parameters
      nHandle:  The converter's handle, which created by method---apOpen.
      Return value
      If the method works successful, it returns the width of a pdf page, otherwise the method works failure. For more error codes, please click here.
     
      。 Method ---apGetPageHeight()
      This method is to get the converter's properties, which created by method---apOpen.
      Syntax
      long apGetPageHeight( long nHandle);
      Parameters
      nHandle:  The converter's handle, which created by method---apOpen.
      Return value
      If the method works successful, it returns the height of a pdf page, otherwise the method works failure. For more error codes, please click here.
     
     
      (2) Properties
      This section describes the properties of the converter detailedly.
     
      。Property String sOutDirectory
      This property can be using to set output directory which the result image files placed in. Default the output directory as same path as the source PDF document.
     
      。Property String sOutPrefix
      This property can be using to set the prefix of file name of the result image.

    For example, the file name of source pdf is 'test.pdf', you set the image type as 'JPEG' format and the value of this property as 'mytest', so the file name of result image are 'mytest00001.jpg', 'mytest00002.jpg',...,'mytest00XXX.jpg', etc.
     
      。Property Integer iPageZoom
      Th property can be using to set zoom scale of PDF pages(10-200).

    For example, if it sets the page zoom as 120 or 80 and the result image is a 800x600 pixel, so the final result image is a 960x720 pixel or 640x480 pixel image.
    Default page zoom is 100.
     
      。Property Integer iBitCount
      This property gets or sets the color depth of an image.
    The component supports the following color depths,default is 24.
      1:    black/white image.
      4:    16 colors image.
      8:    256 colors image.
      24:   true color image.
     
      。Property Integer iXDPI
      This property gets or sets the horizontal resolution of the image.
    The component supports the resolution from 72 to 500, defualt is 120.
     
      。Property Integer iYDPI
      This property gets or sets the vertical resolution of the image.
    The component supports the resolution from 72 to 500, defualt is 120.
     
      。Property Integer iXDimensions
      This property can be used to specify the width of the final result image in pixel.
     
      。Property Integer iYDimensions
      This property can be used to specify the height of the final result image in pixel.
     
      。Property Integer iCompression
      Only the current output images are tiff format, this property is valid, the property can be used to get or set the compression type.
    The supported value of iCompression are listed below(supported color depths in brackets):
     
    Constant Name Value Description
    AP_TIFF_COMPRESSION_NONE 0 No compression(1-bit, 4-bits, 8-bits, 24-bits)
    AP_TIFF_COMPRESSION_LZW 1 Lzw compression(1-bit, 4-bits, 8-bits, 24-bits)
    AP_TIFF_COMPRESSION_JPEG 2 Jpeg compression(8-bits grayscale, 24-bits)
    AP_TIFF_COMPRESSION_PACKBITS 3 Packbits compression(4-bits, 8-bits, 24-bits)
    AP_TIFF_COMPRESSION_CCITTG4 4 CCITT Group 4 compression(1-bit)
    AP_TIFF_COMPRESSION_CCITTG3 5 CCITT Group 3 compression(1-bit)
    AP_TIFF_COMPRESSION_RLE 6 RLE compression(1-bit)
    Default is no compression.
     
      。Property Integer iQuality
      This property gets or sets the compression quality(1..100) for lossy compression types. Default is 75.
     
      。Property Boolean iGrayscale
      This property can be using to set grayscale image.
      TRUE(1):  It is to set grayscale image.
      FALSE(0):  It is to set non-grayscale image.
     
      。Property Boolean iMultiPages
      This property can be using to set multipages tiff files.
      TRUE(1):  It is to set multipages tiff files.
      FALSE(0):  It is to set general tiff files.
     
      。Property Integer iStreamHandle
      A read only property, it can not be set. If only the method apConvertPageToStream() is invoked successful, this property becomes valid and shows the handle of memory stream of the image which are previously saved using method apConvertPageToStream();

    Notice: The stream managed by the component automatically, you need not to allocate or destory it manually.
     
      。Property Integer iStreamSize
      A read only property, it can not be set. If only the method apConvertPageToStream() is invoked successful, this property becomes valid and shows the size of memory stream of the image in byte. The stream are previously saved using method apConvertPageToStream().
     
     
     

    (3) Constants


      。TIFF compression tag's definitions(supported color depths in brackets)
     
    Name Value Description
    AP_TIFF_COMPRESSION_NONE 0 No compression(1-bit, 4-bits, 8-bits, 24-bits)
    AP_TIFF_COMPRESSION_LZW 1 Lzw compression(1-bit, 4-bits, 8-bits, 24-bits)
    AP_TIFF_COMPRESSION_JPEG 2 Jpeg compression(8-bits grayscale, 24-bits)
    AP_TIFF_COMPRESSION_PACKBITS 3 Packbits compression(4-bits, 8-bits, 24-bits)
    AP_TIFF_COMPRESSION_CCITTG4 4 CCITT Group 4 compression(1-bit)
    AP_TIFF_COMPRESSION_CCITTG3 5 CCITT Group 3 compression(1-bit)
    AP_TIFF_COMPRESSION_RLE 6 RLE compression(1-bit)

      。Return code's definitions
     
    Name Value Description
    RTN_OK 1 Successful operation.
    ERR_OVER_MAXTHREADS -1 Over the limit amount of threads.
    ERR_FILE_UNEXIST -2 Source PDF file unexist.
    ERR_FILE_DAMAGED -3 Source PDF file is damaged.
    ERR_FILE_RESTRICTED -4 Source PDF file is restricted.
    ERR_INVALID_PAGE -5 Invalid page of the source pdf.
    ERR_CONVERT_FAILURE -8 Conversion failure.
    ERR_INVALID_STREAM -9 Invalid memory stream's address.
    ERR_INVALID_HANDLE -10 Invalid converter's handle.
    ERR_UNKNOWN -99 Unknown system error.
     

     6. How to ...
         
      (1) How to create multipages tiff images?
      The TIFF image format is a especial image format, which supports multipages images. Using PDF to TIFF SDK/COM to create multipages tiff images is very easy. All you need to is setting the multipages property to TRUE(or 1).
      It looks like the following.
              AxPdf2Tiff.iMultiPages = TRUE; (or)
            AxPdf2Tiff.iMultiPages = 1;

      A completed code for creating multipages tiff in VB.
     

    Dim AxPdf2Tiff As New AP_PDF2TIFF.AxPdf2Tiff
    Dim nHandle As Long

    'Open pdf file and creating a converter.
    nHandle = AxPdf2Tiff.apOpen("sample1.pdf", "", "")
    Select Case nHandle
        Case ERR_OVER_MAXTHREADS
            MsgBox "Over the limit amount of threads,please waiting!"
            Exit Sub
        Case ERR_FILE_UNEXIST
            MsgBox "Source pdf file unexist!"
            Exit Sub
        Case ERR_FILE_DAMAGED
            MsgBox "Source pdf file damaged!"
            Exit Sub
        Case ERR_FILE_RESTRICTED
            MsgBox "Source pdf file restricted!"
            Exit Sub
    End Select


    'Setting the converter's propertys.
    'For more, please refer to above definitions.

    AxPdf2Tiff.sOutDirectory = "./demo1"     'output directory
    AxPdf2Tiff.iMultiPages = 1     'Setting multipages tiff images.

    'Get the amount of the source pdf pages
    Dim iPageCount, iPageNo As Long
    iPageCount = AxPdf2Tiff.apGetPageCount(nHandle)


    'To convert the pdf file.
    For iPageNo = 1 To iPageCount
        AxPdf2Tiff.apConvertPage nHandle, iPageNo
    Next


    'Close pdf file and destory the converter.
    AxPdf2Tiff.apClose nHandle

      Notice: For more detial samples please here to download PDF to TIFF SDK/COM samples.

      (2) How to create memory stream images?
      The PDF to TIFF SDK supports to convert pdf file to memory stream.
    You can save the memory stream to database, to file, or to others, etc.

      The following is a VB sample that save the memory stream to file.
     

    Dim AxPdf2Tiff As New AP_PDF2TIFF.AxPdf2Tiff
    Dim nHandle As Long

    'Open pdf file and creating a converter.
    nHandle =AxPdf2Tiff. apOpen("sample1.pdf", "", "")
    Select Case nHandle
        Case ERR_OVER_MAXTHREADS
            MsgBox "Over the limit amount of threads,please waiting!"
            Exit Sub
        Case ERR_FILE_UNEXIST
            MsgBox "Source pdf file unexist!"
            Exit Sub
        Case ERR_FILE_DAMAGED
            MsgBox "Source pdf file damaged!"
            Exit Sub
        Case ERR_FILE_RESTRICTED
            MsgBox "Source pdf file restricted!"
            Exit Sub
    End Select


    'Setting properties.
    'For more, please refer to above definitions.

    AxPdf2Tiff.sOutDirectory = "./demo1"     'output directory
    AxPdf2Tiff.iXDPI = 120    'horizontal dpi
    AxPdf2Tiff.iYDPI = 120    
    'vertical dpi

    'Get the amount of the source pdf pages
    Dim iPageCount, iPageNo As Long
    iPageCount = AxPdf2Tiff.apGetPageCount(nHandle)


    Dim sImgFile As String
    Dim bBuffer() As Byte


    'To convert the pdf file.
    For iPageNo = 1 To iPageCount
        'You can save image stream to database, to file, or to others, etc.
        AxPdf2Tiff.apConvertPageToStream nHandle, iPageNo

        
    'Here,it saves the memory stream to bytes buffer
        ReDim bBuffer(AxPdf2Tiff.iStreamSize) As Byte
        CopyMemory ByVal VarPtr(bBuffer(0)), ByVal AxPdf2Tiff.iStreamHandle, AxPdf2Tiff.iStreamSize

        
    'Here,it saves the buffer to file.
        If nSize > 0 Then
            sImgFile = "myimg_" + CStr(m_Pages(iPos)) + ".tiff"

            Open sImgFile For Binary As #1
            Put #1, , bBuffer
            Close #1
        End If
    Next


    'Close pdf file and destory the converter.
    AxPdf2Tiff.apClose nHandle

      Notice: For more detial samples please here to download PDF to TIFF SDK/COM samples.

      (3) How to increase/decrease the file size of an image?

      This section will tell you how to increase/decrease the file size of an image. The main factors on which the file size of an image defpend are listed at the following:
      Page zoom
      Resolution (DPI)
      Dimensions(width and height)
      Bits per pixel
      Compression type
      Compression quality
      So you can control image's zoom scale with adjusting the value of above parameters.

      The Page zoom is used to set zoom scale of PDF pages(10-200). For example, if it sets the page zoom as 120 or 80 and the result image is a 800x600 pixel, so the final result image is a 960x720 pixel or 640x480 pixel image. Default page zoom is 100.
      To set page zoom like this:
              AxPdf2Tiff.iPageZoom = 120

      The DPI(dots per inch) value let you specify how detialed the image is. A larger DPI value generates a more detialed image, but also will make the size of the image file larger. On the other hand, a lower DPI value generates files of smaller size, but the image is also of lower quality.The system supports from 72 to 500 DPI, default is 120 DPI.
      To set resolution like this:
              AxPdf2Tiff.iXDPI = 150
            AxPdf2Tiff.iYDPI = 150

      The dimensions of an image can be set in pixel. By setting the dimensions of an image, you can specify the width or height of the final result image in pixel. Increasing/Decreasing the dimensions will affect the amount of total pixel. Obviously a 1024x768 pixel image has a larger file size and more detialed than a 800x600 pixel image.
      To set the dimensions of an image like this:
              AxPdf2Tiff.iXDimensions = 1024
            AxPdf2Tiff.iYDimensions = 768

      Setting the color depths of an image, you can adjust the image's size as you like. Such as 1-bit(black/white), 4-bits or 8-bits grayscale instead of 24-bits true color will reduce the size of the image files, but not all formats support all color depths.
      To set bits count per pixel like this:
              AxPdf2Tiff.iBitCount = 8

      The tiff image format supports to set compression type and the jpeg format or the tiff format which encoded by jpeg compression support to set compression quality. An appropriated compression type generates a more smaller size of image files. A larger compression quality generates a more detialed image, but also will make the size of the image file larger. On the other hand, a lower compression quality generates file of smaller size, but the image is also of lower quality. The system supports from 1 to 100 quality, default is 75.
      To set compression type like this:
              AxPdf2Tiff.iCompression = AP_TIFF_COMPRESSION_LZW
      To set compression quality like this:
    (Only encoded by jpeg compression.)
              AxPdf2Tiff.iQuality = 65
      Notice: For more detial samples please here to download PDF to TIFF SDK/COM samples.

     7. Registration
         (1) Demo version
      You can free download a demo version at http://www.adultpdf.com/products/pdftotiff/index.html
     
    Limitations of the demo version:
    You are allowed to process only up to 10 pages of each pdf files simultaneously.

     
         (2) Buy now
        You can order PDF to TIFF SDK online. Click here to the product site.
      。PDF to TIFF SDK/COM 5threads, only $399, buy now.
      。PDF to TIFF SDK/COM 10threads
    (recommend), only $599, buy now.
      。PDF to TIFF SDK/COM 10+threads, only $799, buy now.
      Click Server License to read the sdk/com license, thanks for your support.

     
         (3) Technology support
     

    Guarantee: We are committed to providing excellent products and support to our customers. If you are dissatisfied with a adultpdf product after your purchase, we will refund your money.

    Privacy Policy: We will not give, sell or otherwise transfer your personal information to third parties. Unless you ask us not to, we will send occasional email about new products and releases.

    Ongoing Open Dialog: Our customers are our most valuable resource. Please let us know how we can improve our products and we will try our best to implement your suggestions.


      If you have some questions about registering our product(s),or programe bugs,or suggestions of our product(s),or suggestions of our site,we will welcome you to contact us.
      Our sales email: sales@adultpdf.com
      Our support email: support@adultpdf.com
     

     8. Copyright&License
     
    adultpdf.com Inc. PDF to TIFF SDK/COM Software License

    THIS IS A CONTRACT. PLEASE READ THIS SOFTWARE LICENSE AGREEMENT CAREFULLY
    BEFORE DOWNLOADING OR USING THE SOFTWARE.

    You agree that all of the terms and conditions below apply to you and
    anyone else who uses this software, if either:

    (1)YOU COPY, INSTALL, OR USE THIS COPY OF PDF to TIFF SDK/COM SOFTWARE, OR
    (2)YOU PERMIT OR ENABLE OTHERS TO COPY, INSTALL OR USE THIS PDF to TIFF SDK SOFTWARE.

    If you do not agree with all of the terms and conditions of this agreement,
    you must:

    (1) IMMEDIATELY CEASE USING THE SOFTWARE
    (2) DESTROY ALL COPIES OF THE SAME, INCLUDING ANY COPIES STORED ON YOUR
    HARD DRIVE AND ANY ARCHIVAL COPIES, AND

    1. License
    PDF to TIFF SDK/COM software ("the Software"), documentation accompanying this
    License on any media or in any form are licensed, to you by adultpdf.com Inc.
    adultpdf.com Inc. retains title to the Software. The Software and any copies
    which this License authorizes you to make are subject to this License.

    2. Scope of use.
    This license is applied to use of The Software by any Licensee that
    has purchased a license, i.e. paid a license fee as defined by adultpdf.com Inc
    and agreed to the terms of this license. This license allows
    you to install and use one copy of the software on multiple computers
    at the same time,which may be connected at any point in time to
    an unlimited number of computers operating on one or more networks.

    3. Transfer
    You may not decompile, reverse engineer, disassemble, rent, lease, resell,
    loan, distribute, or produce derivative works from the Software. You may,
    however, make a one-time permanent transfer of all of your license rights to
    the Software to another party, provided that: (a) the transfer must include
    all of the Software, including all its component parts, original media,
    printed materials and this License; (b) you do not retain any copies of
    the Software, full or partial, including copies stored on a computer or
    other storage device; and (c) the party receiving the Software reads and
    agrees to accept the terms and conditions of this License.

    4. Updated Versions
    The Software may be updated from time to time adultpdf.com Inc at its sole
    discretion. You may obtain such updated versions of the Software from
    adultpdf.com Inc on the terms agreed upon by adultpdf.com Inc and you.
    Such updated versions of the Software are expected to operate more accurately
    and effectively. You acknowledge that you are responsible for downloading
    and installing such updated versions of the Software.

    5. Limitation of Liability
    UNDER NO CIRCUMSTANCES, INCLUDING NEGLIGENCE, SHALL ADULTPDF.COM INC.
    BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
    ARISING OUT OF OR RELATING TO THIS LICENSE. SOME JURISDICTIONS DO NOT
    ALLOW THE LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS
    LIMITATION MAY NOT APPLY TO YOU. IN NO EVENT, ADULTPDF.COM INC.'STOTAL
    LIABILITY TO YOU FOR ALL DAMAGES EXCEED THE AMOUNT YOU PAID TO ADULTPDF.COM
    INC. OR ITS AUTHORIZED DISTRIBUTOR.

    6. Termination
    This License is effective until terminated. Your rights under this License
    will terminate automatically without notice from adultpdf.com Inc if you
    fail to comply with any term(s) of this License. Immediately upon termination
    of this License, you shall cease all use of the Software and destroy all copies,
    full or partial, of the Software. And you will have no right to keep or use
    any copy of the Software and related user documentation for any purpose after
    termination of this Agreement.

    7. Installation
    If you requests installation services with respect to the Software,
    adultpdf.com inc will use its best efforts to install the Software on your
    server. Due to factors outside of adultpdf.com inc's control, including but
    not limited to server configuration and file availability, successful
    installation of the Software is not guaranteed. adultpdf.com inc will not be
    responsible for any losses or damages suffered by yourself as a result of the
    installation or attempted installation of the Software.

    8. Refunds
    In the event that adultpdf.com inc refunds any amounts paid by Licensee for
    the Software, Licensee understands and agrees that this Agreement and the
    Software license are terminated, and adultpdf.com inc will withdraw all Software,
    code and related documentation provided under this Agreement. Upon receipt
    of such refund, Licensee agrees that it will no longer use, display or otherwise
    control the Software, code or related documentation for which the refund
    was issued.

    9. Complete Agreement
    This License constitutes the entire agreement between the parties with respect
    to the use of the Software and supercedes all (if any) prior or contemporaneous
    understandings. No amendment to or modification of this License will be binding
    unless in writing and signed by an authorized officer of adultpdf.com Inc.

    --- end ---
     


    http://www.adultpdf.com  
    Copyright 2000-2009 by AdultPDF Technology, Inc. All rights reserved.