PDF To Image SDK/COM

long MLoad (char *filename, char *password)
long MEncode (long id, long pageno)
long MEncodeEx (long id, long pageno, char *fname)
void MFree (long id)
long MGetCount (long id)
long MGetWidth (long id, long pageno)
long MGetHeight (long id, long pageno)
long MSetParam (long id, char *outpath, long imagetype, long bitcount, long compression, long quality, long grayscale, long multipage, long rotate, long width, long height, long xdpi, long ydpi)
long MSetWatermark (long id, char *text, char *fontname, long fontsize, long fontcolor, long isbold, long isitalic, long isunderline, long position, long xoff, long yoff)
long MExtractText (char *infile,char *password,char *outfile,long mode,long pagebreak)


Register the Component

Step 1. Copy the dll and ocx files to windows system directory.
Windows 32-bit: copy "pdftoimage.dll & pdftoimage.ocx" to C:\Windows\System32
Windows 64-bit: copy "pdftoimage.dll & pdftoimage.ocx" to C:\Windows\SysWOW64

Step 2.Register the component ocx in your system using the regsvr32 program that is provided with the windows operating system.
Windows 32-bit: regsvr32.exe pdftoimage.ocx
Windows 64-bit: c:\windows\syswow64\regsvr32.exe pdftoimage.ocx


Detailed Description

  (SDK) long MLoad
  (COM) long XLoad
( char *filename,
  char *password )
  Open a pdf file.
  Parameters:  
  filename A string that is the path to the desired pdf file.
  password A string that is the password to open pdf file if pdf is restricted.
  Return Value:  
  Return a handle if the open was successful.
Return -1 if input pdf path error or file is damaged.
Return -2 if pdf file is restricted.
   
   
  (SDK) long MEncode
  (COM) long XEncode
( long id,
  long pageno )
  Convert Multi-page PDF file to Multi-page TIFF file or single page BMP, WMF, EMF, PCX, JPG, JP2000, PNG, GIF, TGA etc files.
  Parameters:  
  id A handle to the file.
  pageno Specify page number to convert.
  Return Value:  
  Returns 1 if convert is successfully, otherwise 0.
   
   
  (SDK) long MEncodeEx
  (COM) long XEncodeEx
( long id,
  long pageno
  char *fname )
  Convert Multi-page PDF file to Multi-page TIFF file or single page BMP, WMF, EMF, PCX, JPG, JP2000, PNG, GIF, TGA etc files.
  Parameters:  
  id A handle to the file.
  pageno Specify page number to convert.
  fname Specify output file name.
  Return Value:  
  Returns 1 if convert is successfully, otherwise 0.
   
   
  (SDK) long MFree
  (COM) long XFree
( long id )
  Closes pdf file and deletes the object.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns 1 if the file is successfully closed, otherwise 0.
   
   
  (SDK) long MGetCount
  (COM) long XGetCount
( long id )
  Retrieves the pages count of the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns count of pages, otherwise 0.
   
   
  (SDK) long MGetWidth
  (COM) long XGetWidth
( long id,
  long pageno )
  Retrieves the pages with of the pdf file.
  Parameters:  
  id A handle to the file.
  pageno Specify page number.
  Return Value:  
  Returns width of page, otherwise 0.
   
   
  (SDK) long MGetHeight
  (COM) long XGetHeight
( long id,
  long pageno )
  Retrieves the pages height of the pdf file.
  Parameters:  
  id A handle to the file.
  pageno Specify page number.
  Return Value:  
  Returns height of page, otherwise 0.
   
   
  (SDK) long MSetParam
  (COM) long XSetParam
( long id,
  char *outpath,
  long imagetype,
  long bitcount,
  long compression,
  long quality,
  long grayscale,
  long multipage,
  long rotate,
  long width,
  long height,
  long xdpi,
  long ydpi )
  Set the parameter.
  Parameters:  
  id A handle to the file.
  outpath Set output path. If path is NULL or an empty string, it save in the same folder as source file.
  imagetype Set generated image format. see ENUM_IMAGE_FORMATS.
  bitcount Set the color depth in the generated image file, 1=black and white, 4=16 colors, 8=256 colors, 24=true color. see COLOR_DEPTH.
  compression Set the Compression method in the generated file, see ENUM_COMPRESSION.
  quality Set quality (1 ~ 100) in the generated JPEG file or TIFF file jpeg compression, default 75.
  grayscale The 1 is convert to grayscale image file, this option is only available while bitcount equal 4 and 8.
  multipage The 1 is generate a multi-page TIFF file, the 0 is generate a TIFF file for each page, this option is only available for TIFF files
  rotate Set page rotate angle(0~360).
  width Set page width. e.g. width=1, height=1280, set height as 1280 pixels, and width to according to the pdf page size relative.
  height Set page height. e.g. width=800, height=1, set width as 800 pixels, and height to according to the pdf page size relative.
  xdpi Set horizontal resolution (72 ~ 600), default 72.
  ydpi Set vertical resolution (72 ~ 600), default 72.
  Return Value:  
  Returns 1 if set is successfully, otherwise 0.
   
   
  (SDK) long MSetWatermark
  (SOM) long XSetWatermark
( long id,
  char *text,
  char *fontname,
  long fontsize,
  long fontcolor,
  long isbold,
  long isitalic,
  long isunderline,
  long position,
  long xoff,
  long yoff )
  Text stamping.
  Parameters:  
  id A handle to the file.
  text The content of the stamp.
  fontname Specify page number.
  fontsize Set the font size, default is 16 point.
  fontcolor Specify the text color,range from 0-16777215,default is 255(red).
  isbold Set the font bold.
  isitalic Set the font is italic.
  isunderline Set the font is underlined.
  position The Position of stamps.
1 = Stamps on the Top-Left of the page. (default)
2 = Stamps on the Top-Center of the page.
3 = Stamps on the Top-Right of the page.
4 = Stamps on the Right-Center of the page.
5 = Stamps on the Right-Bottom of the page.
6 = Stamps on the Bottom-Center of the page.
7 = Stamps on the Left-Bottom of the page.
8 = Stamps on the Left-Center of the page.
9 = Stamps on the Center of the page.
  xoff Offset from current position.
e.g 10 Move to right 10 point
e.g -10 Move to left 10 point
  yoff Offset from current position.
e.g 10 Move to bottom 10 point
e.g -10 Move to top 10 point
  Return Value:  
  Returns 1 if set is successfully, otherwise 0.
   
   
  (SDK) long MExtractText
  (COM) long XExtractText
( char *infile,
  char *password,
  char *outfile,
  long mode,
  long pagebreak )
  Extract Text from pdf with Searchable Text and Indexes.
  Parameters:  
  infile A string that is path to the input pdf file.
  password A string that is the password to open pdf file if pdf is restricted.
  outfile A string that is path to the output Text file.
  mode Text output mode.
1 = Maintain original physical layout.
2 = Keep strings in content stream order.
  pagebreak Insert page breaks between pages.
  Return Value:  
  Returns 1 if convert is successfully, otherwise 0.
Return -1 if input pdf path error or file is damaged.
Return -2 if pdf file is restricted.




ENUM_IMAGE_FORMATS

Formats Value Support color depth, 1=black and white, 4=16 colors, 8=256 colors, 24=true color, g=grayscale
IMAGE_FORMAT_TIF 1 1,, 4,, 4-g,, 8,, 8-g,, 24
IMAGE_FORMAT_JPG 2 8-g,, 24
IMAGE_FORMAT_BMP 3 1,, 4,, 4-g,, 8,, 8-g,, 24
IMAGE_FORMAT_PNG 4 1,, 4,, 4-g,, 8,, 8-g,, 24
IMAGE_FORMAT_GIF 5 1,, 4,, 4-g,, 8,, 8-g
IMAGE_FORMAT_PCX 6 1,, 4,, 4-g,, 8,, 8-g,, 24
IMAGE_FORMAT_EMF 7 24
IMAGE_FORMAT_WMF 8 24
IMAGE_FORMAT_TGA 9 8,, 8-g,, 24
IMAGE_FORMAT_JP2 10 8-g,, 24
IMAGE_FORMAT_RAS 11 8-g,, 24
IMAGE_FORMAT_JPC 12 8-g,, 24




ENUM_COMPRESSION

TIFF Compression Value   Support color depth, 1=black and white, 4=16 colors, 8=256 colors, 24=true color, g=grayscale
COMPRESSION_NONE 1 dump mode 1,, 4,, 4-g,, 8,, 8-g,, 24
COMPRESSION_CCITTRLE 2 CCITT modified Huffman RLE 1
COMPRESSION_CCITTFAX3 3 CCITT Group 3 fax encoding 1
COMPRESSION_CCITTFAX4 4 CCITT Group 4 fax encoding 1
COMPRESSION_LZW 5 Lempel-Ziv & Welch 1,, 4,, 4-g,, 8,, 8-g,, 24
COMPRESSION_JPEG 7 %JPEG DCT compression 8-g,, 24
COMPRESSION_PACKBITS 32773 Macintosh RLE 4,, 4-g,, 8,, 8-g,, 24


JPEG Mode Value  
JPEG_PROGRESSIVE 1 Progressive JPEG
JPEG_BASELINE 2 Baseline JPEG
JPEG_OPT_BASELINE 3 Optimized baseline JPEG


Technical Support

Any time that you need help while using products, please contact our support team at support@mgosoft.com.
We promise to our customers that we will deal with emails within 24 hours after receiving them.


Copyright © 2017 Mgosoft.com, Inc