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

Merge pdf not working? permission issue?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1229
Page 1 of 1

Author:  MarkyboyABZ [ Wed Jun 23, 2010 9:59 am ]
Post subject:  Merge pdf not working? permission issue?

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)

Author:  Thomas Hoevel [ Wed Jun 23, 2010 12:13 pm ]
Post subject:  Re: Merge pdf not working? permission issue?

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/

Author:  MarkyboyABZ [ Wed Jun 23, 2010 1:03 pm ]
Post subject:  Re: Merge pdf not working? permission issue?

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" />

Author:  Thomas Hoevel [ Wed Jun 23, 2010 2:08 pm ]
Post subject:  Re: Merge pdf not working? permission issue?

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)

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