Routines for document security, encription and compression.
◆ HPDF_SetCompressionMode()
Set compression mode.
- Parameters
-
pdf | Document object handle. |
mode | One or more of the following values, combined together using binary OR:
|
- Returns
- HPDF_OK on success, otherwise returns error code and calls error handler.
- Error codes
- Examples
- character_map.c, chfont_demo.c, encoding_list.c, image_demo.c, jpeg_demo.c, jpfont_demo.c, png_demo.c, raw_image_demo.c, text_demo.c, and ttfont_demo_jp.c.
◆ HPDF_SetEncryptionMode()
Set the encryption mode. As the side effect, ups the version of PDF to 1.4 when the mode is set to HPDF_ENCRYPT_R3.
- Parameters
-
pdf | Document object handle. |
mode | One of the following values:
Mode | Description |
HPDF_ENCRYPT_R2 | Use "Revision 2" algorithm.
key_len automatically set to 5 (40 bits). |
HPDF_ENCRYPT_R3 | Use "Revision 3" algorithm.
key_len can be 5 (40 bits) to 16 (128bits). |
|
- Parameters
-
key_len | Specify byte length of encryption key. Only valid for HPDF_ENCRYPT_R3, length between 5 (40 bits) and 16 (128 bits) can be specified. |
- Returns
- HPDF_OK on success, otherwise returns error code and calls error handler.
- Error codes
- Examples
- permission.c.
◆ HPDF_SetPassword()
HPDF_STATUS HPDF_SetPassword |
( |
HPDF_Doc |
pdf, |
|
|
const char * |
owner_password, |
|
|
const char * |
user_password |
|
) |
| |
Sets a password for the document. If the password is set, document contents is encrypted.
- Parameters
-
pdf | Document object handle. |
owner_password | Owner password of the document. The owner can change document permission. NULL , zero-length string and the same value as user password are not allowed. |
user_password | User password of the document. The user_password may be set to NULL or zero-length string. |
- Returns
- HPDF_OK on success, otherwise returns error code and calls error handler.
- Error codes
- Examples
- encryption.c, and permission.c.
◆ HPDF_SetPermission()
Set the permission flags for the document.
- Parameters
-
pdf | Document object handle. |
permission | One or more of the following values, combined together using binary OR:
|
- Returns
- HPDF_OK on success, otherwise returns error code and calls error handler.
- Error codes
- Examples
- permission.c.