PdfFileSecurity.SetPrivilege

SetPrivilege(DocumentPrivilege)

Sets Pdf file security with empty user/owner passwords. The owner password will be added by a random string. Throws an exception if process failed.

public bool SetPrivilege(DocumentPrivilege privilege)
ParameterTypeDescription
privilegeDocumentPrivilegeSet privilege.

Return Value

True for success.

Examples

[C#]
string inFile = "D:\\input.pdf"; //The TestPath may be re-assigned.
string outFile = "D:\\output.pdf"; //The TestPath may be re-assigned.
PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile,outFile);		
fileSecurity.SetPrivilege(DocumentPrivilege.Print);

[Visual Basic]
Dim inFile As String =  "D:\\input.pdf"  'The TestPath may be re-assigned.'
Dim outFile As String =  "D:\\output.pdf"  'The TestPath may be re-assigned.'
Dim fileSecurity As PdfFileSecurity = New PdfFileSecurity(inFile,outFile) 
fileSecurity.SetPrivilege(DocumentPrivilege.Print)

See Also


SetPrivilege(string, string, DocumentPrivilege)

Sets Pdf file security with original password. Throws an exception if process failed.

public bool SetPrivilege(string userPassword, string ownerPassword, DocumentPrivilege privilege)
ParameterTypeDescription
userPasswordStringOriginal user password.
ownerPasswordStringOriginal owner password.
privilegeDocumentPrivilegeSet privilege.

Return Value

True for success.

Examples

[C#]
string inFile = "D:\\input.pdf"; //The TestPath may be re-assigned.
string outFile = "D:\\output.pdf"; //The TestPath may be re-assigned.
PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile,outFile);		
fileSecurity.SetPrivilege(userPassword, ownerPassword, DocumentPrivilege.Print);

[Visual Basic]
Dim inFile As String =  "D:\\input.pdf"  'The TestPath may be re-assigned.'
Dim outFile As String =  "D:\\output.pdf"  'The TestPath may be re-assigned.'
Dim fileSecurity As PdfFileSecurity = New PdfFileSecurity(inFile,outFile) 
fileSecurity.SetPrivilege(userPassword, ownerPassword, DocumentPrivilege.Print)

See Also