Programmer's Reference previous  top  next 
This section describes client sdk interfaces detailedly.
 
 
 1. function---oakBegin()
     This function 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 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.
 
 2. function---oakEnd()
     This function 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 function---oakBegin.
    (3) Return value
  It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
 
 
 
 4. function---oakExport()
     This function 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 function---oakBegin.
nPageNo:  A certain page of the pdf file, which will be converted.
    (3) Return value
  It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
 
 
 
 5. function---oakSetup()
     This function is to set the converter's properties, which created by function---oakBegin.
    (1) Syntax
  long oakSetup( long nHandle,
                                        long nIndex,
                                        char *pValue,
                                        long nValue,
                                        long nOther);
    (2) Parameters
nHandle:  The converter's handle, which created by function---oakBegin.
nIndex:  Property tag, refer to the section of definitions of converter's properties.
pValue: A String value of the property. This parameter is valid only just the type of the current property is string.
nValue: An integer value of the property. This parameter is valid only just the type of the current property is integer.
nOther: Only valid for progress call-back. It is used to call-back function as a parameter value.
    (3) Return value
  It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
 
 6. function---oakGetPageTotal()
     This function is to get the number of pages in the PDF document.
    (1) Syntax
  long oakGetPageTotal( long nHandle, long &nValue);
    (2) Parameters
nHandle:  The converter's handle, which created by function---oakBegin.
nValue: it returns the number of pages in the PDF document.
    (3) Return value
  It returns RTN_OK, the function succeeds, otherwise the function fails. For more error codes, please click here.
 
 
 
 Properties
This section describes the properties of the converter detailedly.
 
 
 1. Property oak_PROP_OUTDIR
  This property can be using to set output directory which the result tiff files placed in. Default the output directory as same path as the source PDF document.
 
 2. Property oak_PROP_PREFIX
  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', the value of this property as 'mytest', so the file name of result image are 'mytest00001.tif, 'mytest00002.tif,...,'mytest00XXX.tif, etc.
 
 3. Property oak_PROP_PAGEZOOM
  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 oak_PROP_BITCOUNT
  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.
 
 5. Property oak_PROP_XDPI
  This property gets or sets the horizontal resolution of the image.
The component supports the resolution from 72 to 500, defualt is 120.
 
 6. Property oak_PROP_YDPI
  This property gets or sets the vertical resolution of the image.
The component supports the resolution from 72 to 500, defualt is 120.
 
 7. Property oak_PROP_XDIMENSIONS
  This property can be used to specify the width of the final result image in pixel.
 
 8. Property oak_PROP_YDIMENSIONS
  This property can be used to specify the height of the final result image in pixel.
 
 9. Property oak_PROP_COMPRESSION
  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.
 
 10. Property oak_PROP_QUALITY
  This property gets or sets the compression quality(1..100) for lossy compression types. Default is 75.
 
 11. Property oak_PROP_GRAYSCALE
  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.
 
 12. Property oak_PROP_MULTIPAGES
  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.
 
 13. Property oak_PROP_PAGECOUNT
  This property can be using to get the number of pages in the PDF document.
 
 
 14. Property oak_PROP_PROGRESSFUNC
  Address of the progress call-back function.
 
 
 
Constants
 
 1. Definitions of converter's properties
  (1) properties
Name Value Type Description
oak_PROP_OUTDIR 1 string Destination directory.
oak_PROP_PREFIX 2 string The prefix of the name of result image file.
oak_PROP_PAGEZOOM 3 integer Zoom scale of the source pdf page(10-200%).
oak_PROP_BGCOLOR 4 integer Image background color.
oak_PROP_BITCOUNT 6 integer Color bits per pixel(1bit,4bits,8bits,24bits).
oak_PROP_XDPI 7 integer Horizontal resolution.
oak_PROP_YDPI 8 integer Vertical resolution.
oak_PROP_QUALITY 9 integer JPEG compression quality(0-100).
oak_PROP_COMPRESSION 10 integer TIFF compression mode.
oak_PROP_MULTIPAGES 11 integer Multipages TIFF file.
oak_PROP_GRAYSCALE 12 integer Grayscale image.
oak_PROP_XDIMENSIONS 13 integer The width of the result image in pixel.
oak_PROP_YDIMENSIONS 14 integer The height of the result image in pixel.


(2) properties
Name Value Type Description
oak_PROP_PROGRESSFUNC 40 integer Address of the progress call-back function.

Notice: For more detial properties, please click here.

 2. 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)

 

 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.