PDF Tools SDK

long MSplitBegin(char *infile, char *password)
long MSplit(long id, char *output, long mode, char *range)
long MSplitEnd(long id)
   
long MMergeBegin()
long MMergeInputFiles(long id, char *infile, char *password, char *range)
long MMerge(long id, char *outfile)
long MMergeEnd(long id)
   
long MPwRemoveBegin()
long MPwRemove(long id, char *infile, char *outfile, char *userpassword, char *ownerpassword);
long MPwRemoveEnd(long id)
   
long MEncryptBegin()
long MEncryptPDF(long id, char *infile, char *outfile, char *userpassword, char *ownerpassword, long encryptlevel, long printing, long copying, long changing)
long MEncryptEnd(long id)
   
long MStampBegin(char *input, char *output, char *password)
long MStampAddText(long id, char *text, char *fontname, long fontsize, long color, long outline, long alignment, long position, long rotate, long overlay, long shift_lr, long shift_tb, long action, char *link, long pageno)
long MStampAddLine(long id, long lenWH, long zoom, long lineWidth, long color, long position, long rotate, long overlay, long shift_lr, long shift_tb)
long MStamping(long id, char *pagerange)
long MStampEnd(long id)
   


Detailed Description


  long MSplitBegin ( char *infile,
  char *password )
  Open a pdf file for split.
  Parameters:  
  infile 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 unexist or damaged.
Return -2 if pdf file is restricted.
   
  long MSplit (long id,
char *output,
long mode,
char *range)
  Split pdf.
  Parameters:  
  id A handle to the file.
  output Specify output path or file. while mode=1, is output path; while mode=2, is output file; while mode=3, is output file.
  mode Specify output mode, 1=split pdf into single pages, 2=delete specify pages, 3=extract specify pages.
  range Specify page range to split.
  Return Value:  
  Returns 1 if split is successfully, otherwise 0.
   
  long MSplitEnd (long id)
  Close the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
   
   
   
  long MMergeBegin ()
  Create a pdf file for merge.
  Parameters:  
  NULL  
  Return Value:  
  Return a handle if the create was successful, otherwise 0.
   
  long MMergeInputFiles (long id,
char *infile,
char *password,
char *range)
  Add pdf file for merge.
  Parameters:  
  id A handle to the file.
  infile 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.
  range Specify page range to merge, merge all page if NULL.
  Return Value:  
  Return 1 if add file successful.
Return -1 if pdf file unexist or damaged.
Return -2 if pdf file is restricted.
   
  long MMerge (long id,
char *outfile)
  Start pdf merge.
  Parameters:  
  id A handle to the file.
  outfile A string that is the path to the merge pdf file.
  Return Value:  
  Returns 1 if merge is successfully, otherwise 0.
   
  long MMergeEnd (long id)
  Close the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
   
   
   
  long MPwRemoveBegin ()
  Create a handle for password remove.
  Parameters:  
  NULL  
  Return Value:  
  Return a handle if the create was successful, otherwise 0.
   
  long MPwRemove (long id,
char *infile,
char *outfile,
char *userpassword,
char *ownerpassword)
  Parameters:  
  id A handle to the file.
  infile The path of input pdf file.
  outfile The path of output decrypted pdf file.
  userpassword Document open password.
  ownerpassword Permissions password.
  Return Value:  
  Return 1 successful.
Return -1 no pdf file input.
Return -2 can't open input file.
Return -3 password is not correct.
Return -4 file is not encrypted.
Return -5 can't create target file.
   
  long MPwRemoveEnd (long id)
  Close the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
   
   
   
  long MEncryptBegin ()
  Create a handle for Encrypt.
  Parameters:  
  NULL  
  Return Value:  
  Return a handle if the create was successful, otherwise 0.
   
  long MEncryptPDF (long id,
char *infile,
char *outfile,
char *userpassword,
char *ownerpassword,
long encryptlevel,
long printing,
long copying,
long changing)
  Parameters:  
  id A handle to the file.
  infile The path of input pdf file.
  outfile The path of output encrypted pdf file.
  userpassword Document open password.
  ownerpassword Permission password.
  encryptlevel Set encrypt level 128 or 40.
  printing Permission print.
  copying Permission copy.
  changing Permissions modify.
  Return Value:  
  Return 1 successful.
Return -1 no pdf file input.
Return -2 can't open input file.
Return -3 file has been encrypted before.
Return -4 can't create target file.
   
  long MEncryptEnd (long id)
  Close the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Returns 1 if successfully, otherwise 0.
   
   
   
   
  long MStampBegin (char *input,
char *output,
char *password)
  Open an existing PDF file to stamp.
  Parameters:  
  inpdf A string that is full path to the input PDF file.
  outpdf A string that is full path to the output PDF file.
  password A string that is the password to open pdf file if pdf is restricted.
  Return Value:  
  Return id if the pdf file open successful,
-1 if input pdf is not existing,
-2 if pdf is restricted and password incorrect,
-3 if open the pdf file failed,
otherwise 0.
   
  long MStamping (long id,
char *pagerange)
  Start to stamping.
  Parameters:  
  id A handle to the pdf file.
  pagerange A string that is page range to stamp.
Support "first", "last", "even", "odd", "all"(NULL,default), custom pages, e.g. "2,5-15,20-"
  Return Value:  
  Nonzero if it is successful, otherwise 0.
   
  long MStampAddText (long id,
char *text,
char *fontname,
long fontsize,
long color,
long outline,
long alignment,
long position,
long rotate,
long overlay,
long shift_lr,
long shift_tb,
long action,
char *link,
long pageno)
  Create a Text Stamp.
  Parameters:  
  id A handle to the file.
  text The content of the stamp, Support using variables in stamp content. see Variables
  fontname Set Text font name, default is Times-Roman, see Font
  fontsize Set the font size, default is 16 point if fontsize equal 0
  color Specify the text color, range from 0-16777215,default is 255(red).
  outline Set Text mode option, 0 is solid, 1 is outline.
  alignment Alignment are used to align text on document pages, it only available for multi-line text stamps, 1 is left alignment , 2 is center alignment, 3 is right alignment.
  position Identifies where on the page the stamp item will appear, see Position.
  rotate The Angle for stamps,range from 0-360.
  overlay 1 is under most of alll layers, 0 is top most of all layers(default).
  shift_lr Move current stamp to left or right n point
  shift_tb Move current stamp to top or bottom n point
  action 1 is add a web link, 2 is go to page.
  link Add a web link to a target URL on the Web.
  pageno GoTo Page , Opens a specified page in the current document.
  Return Value:  
  Nonzero if it is successful, otherwise 0.
   
  long MStampAddLine long id,
long lenWH,
long zoom,
long lineWidth,
long color,
long position,
long rotate,
long overlay,
long shift_lr,
long shift_tb)
  Create a Line Stamp.
  Parameters:  
  id A handle to the file.
  lenWH
pecify the line Length, 1 is length equal page width, 2 is length equal page height.
  zoom Zoom of line length. e.g. lenWH=1, zoom=50, Line length equal to half (50%) of the page width.
  lineWidth Line Width, default is 1 if lineWidth equal 0.
  color Specify the text color, range from 0-16777215,default is 0(black).
  position Identifies where on the page the stamp item will appear, see Position.
  rotate The Angle for stamps,range from 0-360.
  overlay 1 is under most of alll layers, 0 is top most of all layers(default).
  shift_lr Move current stamp to left or right n point
  shift_tb Move current stamp to top or bottom n point
  Return Value:  
  Nonzero if it is successful, otherwise 0.
   
  long MStampEnd (long id)
  Close the pdf file.
  Parameters:  
  id A handle to the file.
  Return Value:  
  Nonzero if it is successful, otherwise 0.



Variable

Variable Format Example Output
\t Local time e.g. 11:11:11
\d Local date e.g. 2015-06-16
\D Local date e.g. 16-06-2015
\p Current page number Maybe "Page \p" equal "Page 5"
\P±n Current page number±a specified value Maybe "Page \p+1" equal "Page 6"
\c Total page number Maybe "Total \c" equal "Total 10"
\n New line. Use for multi-line stamps Sample stamp, line1
Sample stamp, line2
Sample stamp, line3
\\ \ (Use when stamp must include backslash character symbol) \
\f Name of file only e.g. "filename.pdf"
\F Local path of the file e.g. "c:\path\"
Note: All variables must be preceded by the slash (\) character. If the \ character is missing, the variable name will appear in the stamped text. If you want to use the \ character in a stamp it must be listed in the stamp file as \\.

Font

Font Code Font Name
ftr Times-Roman
ftb Times-Bold
fti Times-Italic
ftbi Times-BoldItalic
fc Courier
fcb Courier-Bold
fco Courier-Oblique
fcbo Courier-BoldOblique
fh Helvetica
fhb Helvetica-Bold
fho Helvetica-Oblique
fhbo Helvetica-BoldOblique
fs Symbol
 
or select a system font which installed in your system, for example "Arial"

Position

Code Position
1 Top-Left of the page.
2 Top-Center of the page.
3 Top-Right of the page.
4 Right-Center of the page.
5 Right-Bottom of the page.
6 Bottom-Center of the page.
7 Bottom-Left of the page.
8 Left-Center of the page.
9 Center of the page.


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