FPDFSECURITY

Classes

struct  FPDF_SECURITY_HANDLER
 This structure holds a number of interfaces allowing application to use customized security handlers. A security handler is responsible for decrypting data and enforce document permissions. More...

Files

file  fpdfsecurity.h
 

Header file for the security module - encrypt, decrypt and remove encryption from existing PDF documents.


Defines

#define DLLEXPORT
#define STDCALL
#define CDECL
#define FPDFCIPHER_NONE   0
#define FPDFCIPHER_RC4   1
#define FPDFCIPHER_AES   2

Typedefs

typedef void * FPDF_DECRYPT_OUTPUT

Functions

DLLEXPORT void STDCALL FPDF_RegisterSecurityHandler (FPDF_BYTESTRING handler_name, struct FPDF_SECURITY_HANDLER *pHandler)
DLLEXPORT void STDCALL FPDF_DestroySecurityHandler (FPDF_BYTESTRING handler_name, struct FPDF_SECURITY_HANDLER *pHandler)
DLLEXPORT FPDF_BOOL STDCALL FPDF_OutputDecrypted (FPDF_DECRYPT_OUTPUT output, FPDF_BYTESTRING data, int len)
DLLEXPORT FPDF_BOOL STDCALL FPDF_CustomEncrypt (FPDF_DOCUMENT document, FPDF_STRING handler_name, FPDF_SECURITY_HANDLER *pHandler, FPDF_FILEWRITE *fileWrite)
DLLEXPORT FPDF_BOOL STDCALL FPDF_RemoveSecurity (FPDF_DOCUMENT document, FPDF_FILEWRITE *fileWrite)
DLLEXPORT int STDCALL FPDF_GetPasswordLevel (FPDF_DOCUMENT doc)

PDF document permissions, according to PDF Reference, Table 3.20

#define FPDF_PERM_PRINT   0x0004
 bit 3. Print the document
#define FPDF_PERM_MODIFY   0x0008
 bit 4. Modify the contents of the document by operations other than those controlled by bits 6, 9, and 11.
#define FPDF_PERM_EXTRACT   0x0010
 bit 5. Copy or otherwise extract text and graphics from the document by operations other than that controlled by bit 10.
#define FPDF_PERM_ANNOT_FORM   0x0020
 bit 6. Add or modify text annotations, fill in interactive form fields.If bit 4 is also set, create or modify interactive form fields
#define FPDF_PERM_FILL_FORM   0x0100
 bit 9. Fill in existing interactive form fields (including signature fields), even if bit 6 is clear.
#define FPDF_PERM_EXTRACT_ACCESS   0x0200
 bit 10. Extract text and graphics
#define FPDF_PERM_ASSEMBLE   0x0400
 bit 11. Assemble the document, even if bit 4 is clear.
#define FPDF_PERM_PRINT_HIGH   0x0800
 bit 12. Print the document to a representation from which a faithful digital copy of the PDF content could be generated.

Detailed Description

Header file for the security module


Function Documentation

DLLEXPORT FPDF_BOOL STDCALL FPDF_CustomEncrypt ( FPDF_DOCUMENT  document,
FPDF_STRING  handler_name,
FPDF_SECURITY_HANDLER pHandler,
FPDF_FILEWRITE fileWrite 
)

Encrypt the PDF in custom way,the PDF document will be protected by no-standard security handler.

Parameters:
[in]document- Handler to the document.
[in]handler_name- The name of the handler.
[in]pHandler- Pointer to a structure containing callback functions for the handler.
[in]fileWrite- A pointer to a custom file write structure.
Return values:
Trueif encrypt successfully, else False.
DLLEXPORT void STDCALL FPDF_DestroySecurityHandler ( FPDF_BYTESTRING  handler_name,
struct FPDF_SECURITY_HANDLER pHandler 
)

Destroy a PDF security handler with Foxit PDF SDK.

Parameters:
[in]name- Name of the handler.
[in]pHandler- Pointer to a structure containing callback functions for the handler.
Return values:
None.
DLLEXPORT int STDCALL FPDF_GetPasswordLevel ( FPDF_DOCUMENT  doc)

Get level of password

Parameters:
[in]document- Document handle.
Return values:
0for no password, 1 for user level password, 2 for owner level password.
DLLEXPORT FPDF_BOOL STDCALL FPDF_OutputDecrypted ( FPDF_DECRYPT_OUTPUT  output,
FPDF_BYTESTRING  data,
int  len 
)

Output data decrypted by a custom security handler

Parameters:
[out]output- Handler to the output buffer.
[in]data- Pointer to decrypted data.
[in]len- Number of bytes for the decrypted data.
Return values:
TRUEfor success, otherwise FALSE.
DLLEXPORT void STDCALL FPDF_RegisterSecurityHandler ( FPDF_BYTESTRING  handler_name,
struct FPDF_SECURITY_HANDLER pHandler 
)

Register a PDF security handler with Foxit PDF SDK, enabling access to a PDF document protected by non-standard security handler.

Parameters:
[in]name- Name of the handler.
[in]pHandler- Pointer to a structure containing callback functions for the handler.
Return values:
None.
DLLEXPORT FPDF_BOOL STDCALL FPDF_RemoveSecurity ( FPDF_DOCUMENT  document,
FPDF_FILEWRITE fileWrite 
)

Remove all the security setting of the PDF document, the output PDF will be decrypted.

Parameters:
[in]document- Handler to the document.
[in]fileWrite- A pointer to a custom file write structure.
Return values:
Trueif successfully remove the security, else False.