<?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: Get file type from plotter before plot? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10635914#M15191</link>
    <description>&lt;P&gt;You are absolutely Right!&lt;/P&gt;&lt;P&gt;But you asked for a solution for the plotters mentioned above.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Sep 2021 06:08:21 GMT</pubDate>
    <dc:creator>SENL1362</dc:creator>
    <dc:date>2021-09-21T06:08:21Z</dc:date>
    <item>
      <title>Get file type from plotter before plot?</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10626885#M15188</link>
      <description>&lt;P&gt;I have two plotters, PublishToWeb JPG.pc3 and PDFXchange 7.pc3. Is it possible to get the file type of the plot before plotting, preferably from the PlotConfigInfo or something similar if possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to be able to set scale unit to pixels if the plotter is outputting jpg and mm/inches if it's a pdf. I don't know beforehand what plotters are available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 13:02:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10626885#M15188</guid>
      <dc:creator>ottosson_mathias</dc:creator>
      <dc:date>2021-09-16T13:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get file type from plotter before plot?</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10634576#M15189</link>
      <description>&lt;P&gt;You can get a list of PlotDevices with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;PlotConfigManager.RefreshList(RefreshCode.RefreshDevicesList);
string plotDevNames=null;
using (PlotConfigInfoCollection plotDevices= PlotConfigManager.Devices)
{
  if (plotDevices != null &amp;amp;&amp;amp; plotDevices.Count &amp;gt; 0)
  {
   plotDevNames = plotDevices.Cast&amp;lt;PlotConfigInfo&amp;gt;()
   .Select(n =&amp;gt; n.DeviceName).ToList();
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And based on the (pc3)Name of the device you can decide to set the Units, Scale etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;var lm = LayoutManager.Current;
var psv = PlotSettingsValidator.Current;
using (var tr = db.TransactionManager.StartTransaction())
{
  var layoutName = lm.CurrentLayout;
  var layoutId = lm.GetLayoutId(layoutName);
  var layout = (Layout)tr.GetObject(layoutId, OpenMode.ForRead);
  using (var ps = new PlotSettings(layout.ModelType))
  {
    ps.CopyFrom(layout);
    //Set or Change the PlotDevice
    //psv.SetPlotConfigurationName(ps, pc3Name, null);
    //psv.RefreshLists(ps);
    //or Get the PlotDevice and set Units accordingly
    var pc3Name=ps.PlotConfigurationName;
    var psUnits=(pc3Name.Contains("PDF",StringComparison.OrdinalIgnoreCase) ? PlotPaperUnit.Millimeters : PlotPaperUnit.Pixels;
    psv.SetPlotPaperUnits(ps, psUnits);
    layout.CopyFrom(ps);
  }
  tr.Commit();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: you might need this String Extension for the Case Insensitive Compare&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public static class StringExtension
{
  public static bool Contains(this string source, string toCheck, StringComparison compType)
  {
    return source != null &amp;amp;&amp;amp; toCheck != null &amp;amp;&amp;amp; source.IndexOf(toCheck, compType) &amp;gt;= 0;
  }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Sep 2021 15:25:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10634576#M15189</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2021-09-20T15:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get file type from plotter before plot?</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10635879#M15190</link>
      <description>&lt;P&gt;Thanks but this is not a robust solution. The plotter name does not always contain the type of plotter. Bluebeam does not have pdf in its plotter name for example.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 05:34:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10635879#M15190</guid>
      <dc:creator>ottosson_mathias</dc:creator>
      <dc:date>2021-09-21T05:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get file type from plotter before plot?</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10635914#M15191</link>
      <description>&lt;P&gt;You are absolutely Right!&lt;/P&gt;&lt;P&gt;But you asked for a solution for the plotters mentioned above.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 06:08:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10635914#M15191</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2021-09-21T06:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get file type from plotter before plot?</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10635949#M15192</link>
      <description>&lt;P&gt;When you start the AutoCAD Plot command you'll see PDF options for PDF type drivers.&lt;/P&gt;&lt;P&gt;I don't think we have access to these details from the Net API's.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SENL1362_0-1632203969448.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/967583i5B37703D223B1CE4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SENL1362_0-1632203969448.png" alt="SENL1362_0-1632203969448.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a look at my entry to the post: &lt;STRONG&gt;Add plot custom paper size&lt;/STRONG&gt; (&lt;SPAN class="DateTime"&gt;&lt;SPAN class="local-date"&gt;07-30-2014&lt;/SPAN&gt;&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;It shows some C# code to read the contents of PC3 and PMP files. For a PDF type of pc3 you find what you are looking for, as show below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SENL1362_2-1632204340210.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/967587iAC076A92E513E9F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SENL1362_2-1632204340210.png" alt="SENL1362_2-1632204340210.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 06:07:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-file-type-from-plotter-before-plot/m-p/10635949#M15192</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2021-09-21T06:07:46Z</dc:date>
    </item>
  </channel>
</rss>

