PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 7:26 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
PostPosted: Fri Aug 05, 2016 6:47 pm 
Offline

Joined: Fri Aug 05, 2016 6:11 pm
Posts: 1
I encountered an assertion failure when I tried to encrypt some specific pdf file (sorry it's 500KiB with only one page and cannot be uploaded)

and I am using the pdf sharp source code (PDFsharp-1_50-beta3b.zip) to build my own PdfSharp.dll,

I noticed that this pdf triggers the following code in PdfDocument.cs

// HACK: Remove XRefTrailer
if (_trailer is PdfCrossReferenceStream) ----------------> condition got met
_trailer = new PdfTrailer((PdfCrossReferenceStream)_trailer);

Although I have no idea why we need this hack, it seems the failure can be fixed by adding the following codes:

----------------
iref = trailer.Elements.GetReference(Keys.Encrypt);
if (iref != null)
Elements.SetReference(Keys.Encrypt, trailer.Elements.GetReference(Keys.Encrypt));
----------------
in the function "public PdfTrailer(PdfCrossReferenceStream trailer)" in PdfTrailer.cs

Please help to confirm, thx


Top
 Profile  
 
PostPosted: Fri Aug 05, 2016 7:35 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Hi!

My proposed fix for this issue can be found here:
http://stackoverflow.com/a/38593235/1015447

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC


Who is online

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