0

I have problem working with custom assembly on Report Builder. I managed to add my assembly to the Report Builder and allow it to display a word "Hello" on a textbox. When I started adding slightly complex code like adding Ghostscript.NET code into my assembly, I have a lot of obstacle.

These are my code which I am having problem:

    public PDFToImage(string path)
    {
        string directory = Path.GetDirectoryName(Assembly.GetAssembly(typeof(PDFToImage)).Location);
        //_versionInfo = new GhostscriptVersionInfo(directory+@"\gsdll64.dll");

        //_pdfURL = path;
        //_initialize();
    }

The "directory" variable used here is to get the directory of this current assembly's directory where the gsdll64.dll is located. Therefore, I can pass it to GhostscriptVersionInfo constructor.

But I received an error from the Report Builder when running the report :

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

Inside the Report Builder Policy file "RSPreviewPolicy.config" , I added few codegroup and added a permissionset for FileIOPermission:

<CodeGroup class="UnionCodeGroup"
                        version="1"
                        PermissionSetName="FullTrust"
                        Name="MyCodeGroup"
                        Description="Code group for my data processing extension">
                        <IMembershipCondition 
                           class="UrlMembershipCondition"
                           version="1"
                           Url="C:\Program Files (x86)\Microsoft SQL Server\Report Builder 3.0\Spark.Conversion.Document.dll"
                        />
                      </CodeGroup>
                      <CodeGroup class="UnionCodeGroup"
                        version="1"
                        PermissionSetName="IOPermission"
                        Name="MyCodeGroup"
                        Description="Code group for my data processing extension">
                        <IMembershipCondition 
                           class="UrlMembershipCondition"
                           version="1"
                           Url="C:\Program Files (x86)\Microsoft SQL Server\Report Builder 3.0\Spark.Conversion.Document.dll"
                        />
                      </CodeGroup>
                      <CodeGroup class="UnionCodeGroup"
                        version="1"
                        PermissionSetName="IOPermission"
                        Name="MyCodeGroup"
                        Description="Code group for my data processing extension">
                        <IMembershipCondition class="UrlMembershipCondition"
                           version="1"
                           Url="C:\Program Files (x86)\Microsoft SQL Server\Report Builder 3.0\Ghostscript.NET.dll"
                        />
                      </CodeGroup>
                      <CodeGroup class="UnionCodeGroup"
                        version="1"
                        PermissionSetName="FullTrust"
                        Name="MyCodeGroup"
                        Description="Code group for my data processing extension">
                        <IMembershipCondition class="UrlMembershipCondition"
                           version="1"
                           Url="C:\Program Files (x86)\Microsoft SQL Server\Report Builder 3.0\Ghostscript.NET.dll"
                        />
                      </CodeGroup>

But nothing works. I worried if I fixed this issue, the follow up would be the calling of the GhostscriptVersionInfo line which is the second line of code.

Does anyone can give me some idea how to fix this issue? This is the only option for me to turn pdf to image and display it on a report.

KenS
  • 30,202
  • 3
  • 34
  • 51
LittleFunny
  • 8,155
  • 15
  • 87
  • 198
  • This isn't really a Ghostscript question. Ghostscript.NET is a separate project and not part of Ghostscript. I'd suggest you contact the author directly, though he does pop up here as well.I've modified the tag from Ghostscript to Ghostscript.net. – KenS Aug 06 '15 at 10:29
  • Did you try to add this to the web.config under system.web : ? – HABJAN Aug 10 '15 at 10:06

0 Answers0