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)
Parameter Typ Beskrivning
userPassword String Ursprungligt användarlösenord.
ownerPassword String Ursprungligt ägarlösenord.
privilege DocumentPrivilege Ange 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