TrySetPrivilege

PdfFileSecurity.TrySetPrivilege method

Ställer in Pdf-filsäkerhet med originallösenord. Ger inget undantag om processen misslyckades.

public bool TrySetPrivilege(string userPassword, string ownerPassword, DocumentPrivilege privilege)
ParameterTypBeskrivning
userPasswordStringUrsprungligt användarlösenord.
ownerPasswordStringUrsprungligt ägarlösenord.
privilegeDocumentPrivilegeAnge privilegium.

Returvärde

Sant för framgång, eller falskt.

Exempel

[C#]
string inFile = "D:\\input.pdf"; //TestPath kan tilldelas om.
string outFile = "D:\\output.pdf"; //TestPath kan tilldelas om.
PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile,outFile);		
bool result = fileSecurity.TrySetPrivilege(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) 
Dim result As Boolean = fileSecurity.TrySetPrivilege(userPassword, ownerPassword, DocumentPrivilege.Print)

Se även