PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Modification protection
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1777
Page 1 of 1

Author:  jensjuul [ Sat Sep 10, 2011 9:58 am ]
Post subject:  Modification protection

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

Author:  Thomas Hoevel [ Mon Sep 12, 2011 8:07 am ]
Post subject:  Re: Modification protection

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;

Author:  jensjuul [ Wed Sep 14, 2011 11:57 am ]
Post subject:  Re: Modification protection

Thank you for your reply.
Would it be possible to protect the pdf document without password and still protect the password?

Author:  Thomas Hoevel [ Wed Sep 14, 2011 12:18 pm ]
Post subject:  Re: Modification protection

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/