PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Jul 13, 2024 9:24 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Nov 26, 2010 3:50 pm 
Offline

Joined: Fri Nov 26, 2010 3:37 pm
Posts: 2
I was wondering if there was a way to protect the document built using PDFSharp from editing but not require a password to open it. I see the security sample in the documentation and it totally works for me, but i'd have to enter the password each time.

Thanks in advance for any help.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 29, 2010 11:10 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Yes, can be done.
I'll have to look up the details.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 29, 2010 12:37 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
The "trick" is setting an OwnerPassword but no UserPassword.

Here's a code snippet for a PdfDocument document:
Code:
document.SecuritySettings.DocumentSecurityLevel = PdfDocumentSecurityLevel.Encrypted128Bit;
document.SecuritySettings.OwnerPassword = Guid.NewGuid().ToString();
document.SecuritySettings.PermitModifyDocument = false;
document.SecuritySettings.PermitExtractContent = false;
document.SecuritySettings.PermitAnnotations = false;
document.SecuritySettings.PermitAssembleDocument = false;
document.SecuritySettings.PermitFormsFill = false;

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 30, 2010 7:47 pm 
Offline

Joined: Fri Nov 26, 2010 3:37 pm
Posts: 2
Excellant! Thanks so much :D
your suggested worked.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 62 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group