Programmer's Reference previous  top  next 
This section describes the interfaces of the component detailedly.
 
 
 1. Method---oakBegin()
     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.
    (1) Syntax
  long oakBegin(char *pPdfFileName, char *pOwnerPw, char *pUserPw);
    (2) Parameters
pPdfFileName:   Source pdf file name. It supports absolute path and relative path.
pOwnerPw:  Pdf owner password.
pUserPw:   Pdf user password.
    (3) Return value
  If the method succeeds, it returns a converter's handle. If the method 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.
 
 2. Method---oakEnd()
     This method close the pdf file and destroy the converter appointed by the handle.
    (1) Syntax
  long oakEnd(long nHandle);
    (2) Parameters
nHandle:  The converter's handle, which created by method---oakBegin.
    (3) Return value
  It returns RTN_OK, the method succeeds, otherwise the method fails. For more error codes, please click here.
 
 
 4. Method---oakExport()
     This method converts a certain page of the pdf file, the page appointed by the second parameter---nPageNo.
    (1) Syntax
  long oakExport(long nHandle, long nPageNo);
    (2) Parameters
nHandle:  The converter's handle, which created by method---oakBegin.
nPageNo:  A certain page of the pdf file, which will be converted.
    (3) Return value
  It returns RTN_OK, the method succeeds, otherwise the method fails. For more error codes, please click here.
 
 
 6. Method---oakGetPageTotal()
     This method is to get the number of pages in the PDF document.
    (1) Syntax
  long oakGetPageTotal(long nHandle);
    (2) Parameters
nHandle:  The converter's handle, which created by method---oakBegin.
    (3) 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.
 
 
 
 
Properties
This section describes the properties of the component detailedly.
 
 
 1. 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.
 
 2. 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.
 
 3. 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.
 
 4. Property Integer iImageType
  This property can be using to set the result image type. The supported image formats are listed below:
 
Constant Name Value Description
oak_IMAGE_BMP 1 BMP fromat image.
oak_IMAGE_EMF 2 EMF fromat image.
oak_IMAGE_WMF 3 WMF fromat image.
oak_IMAGE_JPG 4 JPG/JPEG fromat image.
oak_IMAGE_PNG 5 PNG fromat image.
oak_IMAGE_GIF 6 GIF fromat image.
oak_IMAGE_TIF 7 TIF/TIFF fromat image.
oak_IMAGE_PCX 8 PCX fromat image.
     
oak_IMAGE_JPEG 4 JPG/JPEG fromat image.
oak_IMAGE_TIFF 7 TIF/TIFF fromat image.
Default is JPG/JPEG format image.
 
 5. 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.
 
 6. 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.
 
 7. 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.
 
 8. Property Integer iXDimensions
  This property can be used to specify the width of the final result image in pixel.
 
 9. Property Integer iYDimensions
  This property can be used to specify the height of the final result image in pixel.
 
 10. 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
oak_TIFF_COMPRESSION_NONE 0 No compression(1-bit, 4-bits, 8-bits, 24-bits)
oak_TIFF_COMPRESSION_LZW 1 Lzw compression(1-bit, 4-bits, 8-bits, 24-bits)
oak_TIFF_COMPRESSION_JPEG 2 Jpeg compression(8-bits grayscale, 24-bits)
oak_TIFF_COMPRESSION_PACKBITS 3 Packbits compression(4-bits, 8-bits, 24-bits)
oak_TIFF_COMPRESSION_CCITTG4 4 CCITT Group 4 compression(1-bit)
oak_TIFF_COMPRESSION_CCITTG3 5 CCITT Group 3 compression(1-bit)
oak_TIFF_COMPRESSION_RLE 6 RLE compression(1-bit)
Default is no compression.
 
 11. Property Integer iQuality
  This property gets or sets the compression quality(1..100) for lossy compression types. Default is 75.
 
 12. 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.
 
 13. 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.
 
 
 
 
 
 
 
Constants  
 

 1. TIFF compression tag's definitions(supported color depths in brackets)
 
 
Name Value Description
oak_TIFF_COMPRESSION_NONE 0 No compression(1-bit, 4-bits, 8-bits, 24-bits)
oak_TIFF_COMPRESSION_LZW 1 Lzw compression(1-bit, 4-bits, 8-bits, 24-bits)
oak_TIFF_COMPRESSION_JPEG 2 Jpeg compression(8-bits grayscale, 24-bits)
oak_TIFF_COMPRESSION_PACKBITS 3 Packbits compression(4-bits, 8-bits, 24-bits)
oak_TIFF_COMPRESSION_CCITTG4 4 CCITT Group 4 compression(1-bit)
oak_TIFF_COMPRESSION_CCITTG3 5 CCITT Group 3 compression(1-bit)
oak_TIFF_COMPRESSION_RLE 6 RLE compression(1-bit)

 2. Image type's definitions
 
 
Name Value Description
oak_IMAGE_BMP 1 Bmp image.
oak_IMAGE_EMF 2 Emf image.
oak_IMAGE_WMF 3 Wmf image.
oak_IMAGE_JPG 4 Jpg/Jpeg image.
oak_IMAGE_PNG 5 Png image.
oak_IMAGE_GIF 6 Gif image.
oak_IMAGE_TIF 7 Tif/Tiff image.
oak_IMAGE_PCX 8 Pcx image.
oak_IMAGE_JPEG 4 Jpg/Jpeg image.
oak_IMAGE_TIFF 7 Tif/Tiff image.

 3. Return code's definitions
 
 
Name Value Description
RTN_OK 1 Successful operation.
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_HANDLE -10 Invalid converter's handle.
ERR_UNKNOWN -99 Unknown system error.
 
 
 
 
 
 
   


http://www.oakdoc.com  
Copyright 2008 by OakDoc Technology, Inc. All rights reserved.