# PDF Encrypt SDK

long | MBegin()
long | MInformation(long id, char *title, char *subject, char *author, char *keywords, char *creator, char *producer)
long | MWatermark(long id, char *text, long fsize, long fcolor, long position, long angle, long xoff, long yoff, long asbackground)
long | MEncryptPDF(long id, char *infile, char *outfile, char *userpassword, char *ownerpassword, long encryptlevel, long printing, long copying, long changing)
long | MEnd(long id)

## Detailed Description

long MBegin | ()
Create a handle for convert.
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 MInformation | (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 MWatermark | (long id, char *text, long fsize, long fcolor, long position, long angle, long xoff, long yoff, long asbackground)
Text stamping.
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.
| angle | The Angle for stamps,range from 0-360.
| 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
| asbackground | Placed text watermark under the existing content.
Return Value: |
| Returns 1 if successfully, otherwise 0.
long MEnd | (long id)
Close the pdf file.
Parameters: |
| id | A handle to the file.
Return Value: |
| Returns 1 if successfully, otherwise 0.

## 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 © 2015 Mgosoft Corporation.