PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Jan 27, 2021 4:23 pm

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Pdf setting permissions
PostPosted: Thu Mar 12, 2020 10:27 am 

Joined: Thu Mar 12, 2020 10:25 am
Posts: 1
i'm using PdfSharp 1.50.5147 and trying to set a restriction/permissions to not allow to print the document.

using (PdfDocument document = PdfReader.Open(output))
document.SecuritySettings.OwnerPassword = "xxxxxx";

// Printing
document.SecuritySettings.PermitPrint = permissions.First(x => x.Permission == Enums.PdfPermission.AllowPrinting).Allow;
document.SecuritySettings.PermitFullQualityPrint = permissions.First(x => x.Permission == Enums.PdfPermission.AllowPrinting).Allow;

// Change document
document.SecuritySettings.PermitModifyDocument = permissions.First(x => x.Permission == Enums.PdfPermission.AllowChangeDocument).Allow;

// Document assembly
document.SecuritySettings.PermitAssembleDocument = permissions.First(x => x.Permission == Enums.PdfPermission.AllowDocumentAssembly).Allow;

// Extract content
document.SecuritySettings.PermitExtractContent = permissions.First(x => x.Permission == Enums.PdfPermission.AllowContentCopying).Allow;

I'm totally sure that the SecuritySettings are set correct (false for PermitPrint and PermitFullQualityPrint, true for the rest) but still in the end when i open the document in Acrobat Reader the Assembly and Content Copying permission is also set to false (disallowed).

Am I missing something?

Reply with quote  
PostPosted: Thu Mar 12, 2020 4:31 pm 
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 323
Already discussed on SO:

I don't think this is a bug in PDFsharp. PDFsharp can only follow the PDF Reference and set some configuration variables in the PDF.
What Adobe Reader makes with those values is beyond our control.

Do you see any descrepancies between PDFsharp and the PDF Reference?

Ă–hmesh Volta ("() => true")
PDFsharp Team Holiday Substitute

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

All times are UTC

Who is online

Users browsing this forum: No registered users and 16 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