PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Jul 19, 2024 9:41 am

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
 Post subject: Modification protection
PostPosted: Sat Sep 10, 2011 9:58 am 
Offline

Joined: Sat Sep 10, 2011 9:47 am
Posts: 2
Hello,

I've made an application for a customer using PdfSharp. Now he wants the generated pdf files protected against modication using Adobe Acrobat Professionel. I've tried using the PermitModifyDocument = false; property, but it doesn't seem to work.

How do I accomplish this task? If it cannot be done using PdfSharp do you know any components that can do it?

Best regards,
Jens


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 12, 2011 8:07 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi, Jens!
jensjuul wrote:
I've tried using the PermitModifyDocument = false; property, but it doesn't seem to work.
Did you set a password?

PDFsharp currently supports the password protection that was used up to Adobe 5.0. The technique is not safe, but it will prevent people from modifying files with Adobe Reader.

Sample code:
http://www.pdfsharp.net/wiki/ProtectDoc ... ample.ashx

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: Wed Sep 14, 2011 11:57 am 
Offline

Joined: Sat Sep 10, 2011 9:47 am
Posts: 2
Thank you for your reply.
Would it be possible to protect the pdf document without password and still protect the password?


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 14, 2011 12:18 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
jensjuul wrote:
Would it be possible to protect the pdf document without password and still protect the password?
Kannitverstan.

If you set an owner password, but no user password, then everybody can open the document using Adobe Reader without entering a password.
But a password is needed to make changes in Adobe Acrobat.
Watch it, but don't modify it. That's what the code snippet in the previous post does.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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 51 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