PDF Stamp SDK

long MBegin(char *input, char *output, char *password)
long MStamping(long id, char *pagerange)
long MEnd(long id)
long MAddText(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 MAddImage(long id, char *filename, long width, long height, long position, long rotate, long overlay, long shift_lr, long shift_tb, long action, char *link, long pageno)
long MAddLine(long id, long lenWH, long zoom, long lineWidth, long color, long position, long rotate, long overlay, long shift_lr, long shift_tb)


Detailed Description


  long MBegin (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 MAddText (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 MAddImage (long id,
char *filename,
long width,
long height,
long position,
long rotate,
long overlay,
long shift_lr,
long shift_tb,
long action,
char *link,
long pageno)
  Create a Image Stamp.
  Parameters:  
  id A handle to the file.
  filename Image file to stamp, it must a full path. e.g. "c:\jpg.jpg", Support jpg, tif, gif, bmp, png, ico, tga, pcx, wmf, emf, jp2, j2k, j2c, jpc, pnm, ppm, pgm and so on.
  width Custom image width, 0 is original width.
  height Custom image height, 0 is original height.
  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 MAddLine 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 MEnd (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. 2016-06-16
\D Local date e.g. 16-06-2016
\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