PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 30, 2024 11:18 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: Wed Jun 23, 2010 9:59 am 
Offline

Joined: Wed Jun 23, 2010 9:11 am
Posts: 2
Hi People,

I am attempting to use PDFsharp to merge a bunch of PDF files on a sharepoint site. At this point i am not meging files from the doclib but simply a folder within the iis site. I can read and write new pdf docs, but when it comes to merge them i have an issue. I am not using PDF sharp to write the new pdf docs but ExpertPDF as i am creating HtmlToPdf documents

The trust level on the sharepoint site has a custom policy, is there anything i need to add to the policy for the pdf sharp libary? i have attached the policyfile as a txt file if anyone want to view it.

the error i am recieveing is as follows, can anyone point me in the right direction?


--------------------------------------------------------------------------------
Unable To Merge PDF documents
1 : PdfSharp.Pdf.Advanced.PdfCatalog..ctor(PdfSharp.Pdf.PdfDictionary)

--------------------------------------------------------------------------------
Stack Trace
at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at PdfSharp.Pdf.PdfDictionary.DictionaryElements.CreateDictionary(Type type, PdfDictionary oldDictionary) at PdfSharp.Pdf.PdfDictionary.DictionaryElements.GetValue(String key, VCF options) at PdfSharp.Pdf.Advanced.PdfTrailer.get_Root() at PdfSharp.Pdf.PdfDocument.get_Catalog() at PdfSharp.Pdf.PdfDocument.get_PageCount() at PDFGenerator.MergeDocuments() at PDFGenerator.uxMerge_Click(Object sender, EventArgs e)


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 23, 2010 12:13 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
Hi!

No file attached.

I googled a little bit.
Maybe the ReflectionPermission is missing.

The article I found:
http://blogs.rev-net.com/ddewinter/2009 ... ium-trust/

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 23, 2010 1:03 pm 
Offline

Joined: Wed Jun 23, 2010 9:11 am
Posts: 2
Hi,

Thanks for your help.

i added the ReflectionPermission to the config file and it worked? thanks for pinpointing that peice of information, much appreciated.

As i am doing this on a dev server as a proof of concept, i am going to be asked what the ReflectionPermission is used for when moving to the UAT site
And why is it needed. What does the component use it for? Can you help with any sort of answer?

<SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

<IPermission class="ReflectionPermission" version="1" Unrestricted="true" />


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 23, 2010 2:08 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
PDFsharp was originally implemented with .NET 1.1.

This routine
Code:
PdfDictionary CreateDictionary(Type type, PdfDictionary oldDictionary)

uses reflection to find the constructor for Type type (this technique is also used in other classes).

Generics were not available yet.
Nowadays it would rather be like this:
Code:
PdfDictionary<T> CreateDictionary<T>(PdfDictionary<T> oldDictionary)

_________________
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 46 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