PDF Image Converter SDK

long MPdf2imgBegin (char *inpdf, char *password)
long MPdf2imgGetCount (long id)
long MPdf2imgGetWidth (long id, long pageno)
long MPdf2imgGetHeight (long id, long pageno)
long MPdf2imgSetParam (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 MPdf2imgWatermark (long id, char *text, char *fontname, long fontsize, long fontcolor, long isbold, long isitalic, long isunderline, long position, long xoff, long yoff)
long MPdf2imgConvert (long id, long pageno, char *fname)
void MPdf2imgEnd (long id)
   
   
long MImg2pdfBegin()
long MImg2pdfAddFiles(long id, char *imgfile)
long MImg2pdfEncrypt(long id, char *userpassword, char *ownerpassword, long encryptlevel, long printing, long copying, long changing)
long MImg2pdfInformation(long id, char *title, char *subject, char *author, char *keywords, char *creator, char *producer)
long MImg2pdfWatermark(long id, char *text, long fsize, long fcolor, long position)
long MImg2pdfSetParam(long id, long type, char *sparam, char *sparam2, long iparam, long iparam2)
long MImg2pdfConvert(long id, char *output)
long MImg2pdfEnd(long id)


Detailed Description

>
  long MPdf2imgBegin (char *inpdf, char *password)
  Open a pdf file.
  Parameters:  
  inpdf 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 pdf file can not open.
Return -2 if pdf file is restricted.
   
  long MPdf2imgConvert (long id, long pageno, char *fname)
  Convert PDF file toTIFF, BMP, WMF, EMF, PCX, JPG, JP2000, PNG, GIF, TGA etc files. Image formats.
  Parameters:  
  id A handle to the file.
  pageno Specify page number to convert.
  fname Specify output image file name.
  Return Value:  
  Returns 1 if convert is successfully, otherwise 0.
   
  long MPdf2imgEnd ( long id )
  Closes pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns 1 if the file is successfully closed, otherwise 0.
   
  long MPdf2imgGetCount ( long id )
  Retrieves the pages count of the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns count of pages if successfully, otherwise 0.
   
  long MPdf2imgGetWidth ( 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 if successfully, otherwise 0.
   
  long MPdf2imgGetHeight ( 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 if successfully, otherwise 0.
   
  long MPdf2imgSetParam (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 output 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.
   
  long MPdf2imgWatermark (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.
   
   
   
  long MImg2pdfBegin ()
  Create a handle for convert.
  Parameters:  
  NULL  
  Return Value:  
  Return a handle if successful, otherwise 0.
   
  long MImg2pdfEncrypt (long id, char *userpassword, char *ownerpassword, long encryptlevel, long printing, long copying, long changing)
  Encrypt pdf.
  Parameters:  
  id A handle to the file.
  userpassword Document Open password.
  ownerpassword Permissions password.
  encryptlevel Encryption Level. 128-bit, 40-bit.
  printing Permit Printing.
  copying Permit Content Copying or Extraction.
  changing Permit Changing the Document.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
  long MImg2pdfInformation (long id, char *title, char *subject, char *author, char *keywords, char *creator, char *producer)
  Set pdf information.
  Parameters:  
  id A handle to the file.
  title Set 'title' to PDF file
  subject Set 'subject' to PDF file.
  author Set 'author' to PDF file.
  keywords Set 'keywords' to PDF file.
  creator Set 'creator' to PDF file.
  producer Set 'producer' to PDF file.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
  long MImg2pdfWatermark (long id, char *text, long fsize, long fcolor, long position)
  Pdf watermark.
  Parameters:  
  id A handle to the file.
  text The content of the stamp.
  fsize Set the font size, default is 16 point.
  fcolor Specify the text color,range from 0-16777215,default is 255(red).
  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.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
  long MImg2pdfConvert (long id, char *output)
  Convert image file to pdf file.
  Parameters:  
  id A handle to the file.
  output A string that is path to the output PDF file. e.g.
"c:\image.pdf", Combine all image files to one PDF file.
"c:\imagepdf\", Convert one image to one pdf file to the destination folder.
NULL, Convert to the source file folder.
  Return Value:  
  Returns 1 if convert is successfully, -1 if no image file input, otherwise 0.
   
  long MImg2pdfAddFiles (long id, char *imgfile)
  Add image files, support Image Formats.
  Parameters:  
  id A handle to the file.
  imgfile A string that is the path to the image file.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
  long MImg2pdfSetParam (long id, long type, char *sparam, char *sparam2, long iparam, long iparam2)
  Set output parameter.
  Parameters:  
  id A handle to the file.
  type Set parameter type, see TYPE.
  sparam A String value of the parameter.
  sparam2 A String value of the parameter.
  iparam A integer value of the parameter.
  iparam2 A integer value of the parameter.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
  long MImg2pdfEnd (long id)
  Close the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   




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



TYPE

Type Value  
PARAM_DPI 100 Set DPI (72-1200). invalid if set "PARAM_PAGESIZE".
PARAM_SKEW 101 Skew correct for black/white tiff file. (only for tiff file)
PARAM_BOOKMARK 102 Set Bookmarks.
1 = use the page number as bookmarks.
2 = use the short filename as bookmarks.
3 = use the full filename as bookmarks.
PARAM_ROTATE 103 Set page rotate. "90, 180, 270"
PARAM_PAGESIZE 104 Set page size and image position,
Page size support: "A3, A4, A5, B5, Letter, Legal",or set custom size.
Image position: 1 = Fit page, 2 = Stretch, 3 = Center.
e.g. MImg2pdfSetParam(id,PARAM_PAGESIZE,"600","800",1,0) is set page width 600, height 800, and image fit page.
e.g. MSetParam(id,PARAM_PAGESIZE,"A4",0,3,0) is set page A4, and center image.
PARAM_CTIFF 105 Set color tiff recompress,"lzw","zip","packbits","jpeg". (only for tiff file)
Jpeg quality (0-100,default is 75) if selected jpeg compress arithmetic.
e.g. MImg2pdfSetParam(id,PARAM_CTIFF,"jpeg",0,80,0) is set jpeg recompress, and quality is 80.
PARAM_GTIFF 106 Set graycale tiff recompress,"lzw","zip","packbits","jpeg". (only for tiff file)
Jpeg quality (0-100,default is 75) if selected jpeg compress arithmetic.
e.g. MImg2pdfSetParam(id,PARAM_GTIFF,"jpeg",0,50,0) is set jpeg recompress, and quality is 50.
PARAM_BWTIFF 107 Set black-white tiff recompress,"lzw","zip","g3","g4". (only for tiff file)
VIEW_SHOW 200 Document options
1 = Show page only
2 = Show the bookmark panel
3 = Show the thumbnail panel
VIEW_ZOOM 201 Display & zoom
1 = Fit to width of page
2 = Fit one full page to window
VIEW_RESIZE 202 Resize window to the initial page
VIEW_CENTER 203 Center window on screen
VIEW_FULL 204 Open in full screen mode
VIEW_HIDEM 205 Hide Menu bar
VIEW_HIDET 206 Hide Toolbars
VIEW_HIDEC 207 Hide Window controls

IMAGE_FORMATS

Formats
TIF File(*.tif;*tiff)
JPG File(*.jpg;*.jpeg)
JPEG2000 File(*.jp2;*.jpc)
BMP File(*.bmp;*.dib)
PNG File(*.png)
GIF File(*.gif)
PPM File(*.ppm)
PNM File(*.pnm)
PBM File(*.pbm)
PSD File(*.psd)
PCX File(*.pcx)
DCX File(*.dcx)
ICON File(*.ico)
EMF File(*.emf)
WMF File(*.wmf)
TGA File(*.tga)


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