<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PDFSharp compatibility? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6688585#M61974</link>
    <description>&lt;P&gt;@Anonymous﻿&amp;nbsp;What I'm trying to accomplish is a little complicated (by my standards) so I'll break it down in to the steps I'm taking:&lt;/P&gt;&lt;P&gt;1. I need to grab all family instances from my drawing;&lt;/P&gt;&lt;P&gt;2. From these family instances, some of them have URLs attached - I then collect those;&lt;/P&gt;&lt;P&gt;3. After I have&amp;nbsp;a List&amp;lt;string&amp;gt; of my URL's, I visit those URL's that have what's known as cut sheets on them;&lt;/P&gt;&lt;P&gt;4. I pull the cut sheet images and store them in to an Image[ ];&lt;/P&gt;&lt;P&gt;5. I then place those images from the array in to a Rectangle, and place the rect on to a PdfPage - these pages are also an array;&lt;/P&gt;&lt;P&gt;6. I then create a PdfDocument by adding the PdfPage[ ] to it;&lt;/P&gt;&lt;P&gt;7.&amp;nbsp;Then users have the option of saving and/or printing the PdfDocument;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the PdfSharp namespace to accomplish this, and there are no problems with the code.&amp;nbsp; Everything would work fine, except for the fact that every time I click the ribbon button that would execute this code, I get the exception that I've attached.&amp;nbsp; It tells me it cannot load the file or assembly.&amp;nbsp; I've looked and verified that the .dll's are installed and in all the correct file paths; I've ensure that the Assembly.cs files are also there.&amp;nbsp; I have absolutely no idea how to remedy this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have any idea what to do, it would be a huge help!!&amp;nbsp; And let me know if you need more information.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Nov 2016 15:22:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-11-15T15:22:09Z</dc:date>
    <item>
      <title>PDFSharp compatibility?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6682578#M61971</link>
      <description>&lt;P&gt;I'm trying to use PDF document variables in Revit, so I downloaded and installed the PDFSharp NuGet in Visual Studio.&amp;nbsp; It all installed easily and I don't get any errors in my code; Revit launches with no errors...&amp;nbsp; But when I launch the button event handler to create a PDF, I get an error.&amp;nbsp; I've attached it.&amp;nbsp; I'm wondering if there's some kind of&amp;nbsp;compatibility with Revit and the PDFSharp package.&amp;nbsp; I honestly have no idea why it's happening, so if anyone has any insight, it would be tremendously helpful!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 15:26:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6682578#M61971</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-11T15:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: PDFSharp compatibility?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6682963#M61972</link>
      <description>&lt;P&gt;I also am getting this error now:&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 17:53:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6682963#M61972</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-11T17:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: PDFSharp compatibility?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6687952#M61973</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am unsure of what you are trying to achieve...&lt;/P&gt;
&lt;P&gt;If you want to print drawing to pdf you need to use a installed PDF-printer such as Adobe PDF or CutePDF and then print.&lt;BR /&gt;Here is an example:&lt;BR /&gt;PrintManager pm = _doc.GetPrintManager();&lt;BR /&gt;pm.SelectNewPrinter("Adobe PDF");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Find your printsettings by looking here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var printSettingsList = _doc.GetPrintSettingIds().Select(x=&amp;gt;_doc.GetElement(x));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Set appropriate printsetting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pm.CurrentPrintSetting = [the printsetting you want]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pm.Apply();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//find all your views and then iterate over them and submit print for each&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pm.SubmitPrint([view])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 10:21:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6687952#M61973</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-15T10:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: PDFSharp compatibility?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6688585#M61974</link>
      <description>&lt;P&gt;@Anonymous﻿&amp;nbsp;What I'm trying to accomplish is a little complicated (by my standards) so I'll break it down in to the steps I'm taking:&lt;/P&gt;&lt;P&gt;1. I need to grab all family instances from my drawing;&lt;/P&gt;&lt;P&gt;2. From these family instances, some of them have URLs attached - I then collect those;&lt;/P&gt;&lt;P&gt;3. After I have&amp;nbsp;a List&amp;lt;string&amp;gt; of my URL's, I visit those URL's that have what's known as cut sheets on them;&lt;/P&gt;&lt;P&gt;4. I pull the cut sheet images and store them in to an Image[ ];&lt;/P&gt;&lt;P&gt;5. I then place those images from the array in to a Rectangle, and place the rect on to a PdfPage - these pages are also an array;&lt;/P&gt;&lt;P&gt;6. I then create a PdfDocument by adding the PdfPage[ ] to it;&lt;/P&gt;&lt;P&gt;7.&amp;nbsp;Then users have the option of saving and/or printing the PdfDocument;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the PdfSharp namespace to accomplish this, and there are no problems with the code.&amp;nbsp; Everything would work fine, except for the fact that every time I click the ribbon button that would execute this code, I get the exception that I've attached.&amp;nbsp; It tells me it cannot load the file or assembly.&amp;nbsp; I've looked and verified that the .dll's are installed and in all the correct file paths; I've ensure that the Assembly.cs files are also there.&amp;nbsp; I have absolutely no idea how to remedy this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have any idea what to do, it would be a huge help!!&amp;nbsp; And let me know if you need more information.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 15:22:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6688585#M61974</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-15T15:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: PDFSharp compatibility?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6693170#M61975</link>
      <description>&lt;P&gt;I see. &lt;BR /&gt;When I get that error its usually because another addin is using another version of the 3rd party lib that Im using, and it so happens to be that Revit loaded that addin and 3rd party lib first. Everything is loaded into the same appdomain so it takes the first version it finds, sort of. Thats how the default assembly resolver works, in my experience at least.&lt;/P&gt;
&lt;P&gt;Make sure no other addin is loaded except yours, also, we've been having problems with Autodesk loading 3rd party libs, and they are harder to turn off, so you have/had to match their version. I think that has been fixed now though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option is to hook up to the AppDomain.AssemblyResolve event and make sure you provide your own version of the lib at runtime.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I've would start with removing all other running addons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Erik&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2016 12:05:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6693170#M61975</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-17T12:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: PDFSharp compatibility?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6693547#M61976</link>
      <description>&lt;P&gt;What we're working on is an Add-In for Revit, and PDFSharp is an add-in for us.&amp;nbsp; I've tried removing and reinstalling it several times, but I get the same result every single time.&amp;nbsp; I think your solution will be really helpful though!&amp;nbsp; I appreciate it.&amp;nbsp; I need to dig around some files today and resolve this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, again, Erik!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~Geoff&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2016 14:54:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pdfsharp-compatibility/m-p/6693547#M61976</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-17T14:54:06Z</dc:date>
    </item>
  </channel>
</rss>

