<?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: Printer Paper Sizes in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275683#M57883</link>
    <description>&lt;P&gt;OK. Converted to VB and tried the code&lt;/P&gt;&lt;PRE&gt;   Public Sub QueryDetailedNamedPlotStyles()
       Dim plSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
      CurDb.TileMode = False
      AcadEdt.SwitchToPaperSpace()
      Using tr As Transaction = CurDb.TransactionManager.StartTransaction()
         Dim plotDict As DBDictionary = DirectCast(CurDb.PlotSettingsDictionaryId.GetObject(OpenMode.ForRead), DBDictionary)
         AcadEdt.WriteMessage(vbLf &amp;amp; "{0} NamedPlotStyles", plotDict.Count)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;etc.&lt;/P&gt;&lt;P&gt;plotDict.Count alwats returns 0, so I don't get the sizes etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I went to Page Setup, ensured I had a plotter set etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, in reality the idea is to plot automatically so people don't have to setup Page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Dec 2011 11:23:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-12-28T11:23:46Z</dc:date>
    <item>
      <title>Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3274787#M57879</link>
      <description>&lt;P&gt;I am trying to get the various sizes of paper for each printer. I can do this for Windows Printers.&lt;/P&gt;&lt;P&gt;But&amp;nbsp;I also want to get the sizes of the .pc3 files.&lt;/P&gt;&lt;P&gt;So far I have this.&lt;/P&gt;&lt;PRE&gt;   Friend Function GetPaperSizes(ByVal Plotter As String) As StringCollection
      For i = 0 To PrinterSettings.InstalledPrinters.Count - 1
         ps.PrinterName = PrinterSettings.InstalledPrinters.Item(i)
         For j = 0 To ps.PaperSizes.Count - 1
            pz = ps.PaperSizes.Item(j)
            AcadEdt.WriteMessage(vbLf &amp;amp; pz.PaperName &amp;amp; " w=" &amp;amp; pz.Width * 0.254 &amp;amp; " h=" &amp;amp; pz.Height * 0.254)
         Next
      Next
      Dim p As PlotConfig = PlotConfigManager.SetCurrentConfig(Plotter)
      Dim t As String = p.Comment
      AcadEdt.WriteMessage(vbLf &amp;amp; t)
      Using tr As Transaction = CurDb.TransactionManager.StartTransaction()
         Dim lyMgr As LayoutManager = LayoutManager.Current                               '  Get the current layout
         Dim cLayout As Layout = tr.GetObject(lyMgr.GetLayoutId(lyMgr.CurrentLayout), OpenMode.ForRead)
         Dim cpInfo As PlotInfo = New PlotInfo()                                          '  Get the PlotInfo from the layout 
         cpInfo.Layout = cLayout.ObjectId                                                 '  Get a copy of the PlotSettings from the layout
         Dim cpSet As PlotSettings = New PlotSettings(cLayout.ModelType)
         cpSet.CopyFrom(cLayout)                                                          '  Update the PlotConfigurationName property of the PlotSettings object
         Dim s As String = pl.Comment
         '  Returns a list of media sizes that are supported for the current device or the PC3 files. (Acad Help)
         '  except that it always returns ""
         Dim cpVdr As PlotSettingsValidator = PlotSettingsValidator.Current
         Try
            Return cpVdr.GetCanonicalMediaNameList(cpSet)
         Catch ex As Exception
            Return Nothing
         End Try
      End Using
   End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;So,&lt;/P&gt;&lt;P&gt;I am looking for the various sheet descriptions + width and height.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All help gratefully received.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 10:33:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3274787#M57879</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-27T10:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275647#M57880</link>
      <description>&lt;P&gt;These (C#) samples may help you to find the answers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1: QueryPlotters()&lt;/P&gt;&lt;P&gt;2: QueryMediaNames()&lt;/P&gt;&lt;P&gt;3: QueryPlotStyles()&lt;/P&gt;&lt;P&gt;4: QueryPaperSize()&lt;/P&gt;&lt;P&gt;5: QueryNamedPlotStyles()&lt;/P&gt;&lt;P&gt;6: QueryDetailedNamedPlotStyles()&lt;/P&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>Wed, 28 Dec 2011 10:41:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275647#M57880</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2011-12-28T10:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275663#M57881</link>
      <description>&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;I've got a bit of this already, but you may well have found the missing bits for me.&lt;/P&gt;&lt;P&gt;Let me have a look and I'll get back to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 11:01:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275663#M57881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-28T11:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275673#M57882</link>
      <description>&lt;P&gt;Watchout for the custom papersizes when creating NamedPlotStyles.&lt;/P&gt;&lt;P&gt;These custom papersizes are referenced by their internal id and those&amp;nbsp; may alter when newley defined in a PC3 file or in the Printer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 11:10:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275673#M57882</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2011-12-28T11:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275683#M57883</link>
      <description>&lt;P&gt;OK. Converted to VB and tried the code&lt;/P&gt;&lt;PRE&gt;   Public Sub QueryDetailedNamedPlotStyles()
       Dim plSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
      CurDb.TileMode = False
      AcadEdt.SwitchToPaperSpace()
      Using tr As Transaction = CurDb.TransactionManager.StartTransaction()
         Dim plotDict As DBDictionary = DirectCast(CurDb.PlotSettingsDictionaryId.GetObject(OpenMode.ForRead), DBDictionary)
         AcadEdt.WriteMessage(vbLf &amp;amp; "{0} NamedPlotStyles", plotDict.Count)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;etc.&lt;/P&gt;&lt;P&gt;plotDict.Count alwats returns 0, so I don't get the sizes etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I went to Page Setup, ensured I had a plotter set etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, in reality the idea is to plot automatically so people don't have to setup Page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 11:23:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275683#M57883</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-28T11:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275709#M57884</link>
      <description>&lt;P&gt;Propably an empty drawing -- no Named Plot Styles.&lt;/P&gt;&lt;P&gt;Try to add some from within paperspace: File/Page Setup Manager/New...&lt;/P&gt;&lt;P&gt;Enter Printer/Pc3, Papersize, PlotArea, PlotScale, Orientation&amp;nbsp; and Pen Table&lt;/P&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>Wed, 28 Dec 2011 11:43:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275709#M57884</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2011-12-28T11:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275717#M57885</link>
      <description>&lt;P&gt;Sorry. Didn't look closely enough.&lt;/P&gt;&lt;P&gt;I think QueryMediaNames may do the trick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Incidently, I didn't know you could do what you do with the WriteMessage function. Neat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll get back&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 12:09:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275717#M57885</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-28T12:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275723#M57886</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Incidently, I didn't know you could do what you do with the WriteMessage function. Neat.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you referring to the Formatting of strings such as in:&lt;/P&gt;&lt;P&gt;&amp;nbsp; ed.WriteMessage("\n\tPaper: {0:0.00} X {1:0.00} ({2})",&amp;nbsp; ps.PlotPaperSize.X, ps.PlotPaperSize.Y, ps.CanonicalMediaName);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You&amp;nbsp; can use that&amp;nbsp; in any&amp;nbsp; String&amp;nbsp; operation, like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; String myFormattedString =String.Format("{0:0.0}", TheValue);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // "0.0"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String.Format("{0:0.0}", 0.0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // "0.0"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;String.Format("{0:0.#}", 0.0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // "0"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 12:30:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275723#M57886</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2011-12-28T12:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275947#M57887</link>
      <description>&lt;P&gt;I've got it working and it is just what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PSizes is used elsewhere and is a global variable. It contains the Width and Height and I use the CanonicalMediaName as a key.&lt;/P&gt;&lt;P&gt;a_Paper.Suffix is read from an INI file and contains MM, or CM or INCHES etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my code is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;   Public Sub QueryMediaNames()
      PSizes = New Collection
      Dim layMgr As LayoutManager = LayoutManager.Current
      Dim plSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
      Using tr As Transaction = CurDb.TransactionManager.StartTransaction()
         Dim ly As Layout = DirectCast(tr.GetObject(layMgr.GetLayoutId(layMgr.CurrentLayout), OpenMode.ForRead), Layout)
         Dim np As New PlotSettings(ly.ModelType)
         np.CopyFrom(ly)
         Dim canMedNames As StringCollection = plSetVdr.GetCanonicalMediaNameList(np)
         Dim i As Integer, s As String
         For Each c As String In canMedNames
            If c.ToUpper.Contains(a_Paper.Suffix.ToUpper) Then
               i = InStr(c, "(")
               If i &amp;gt; 0 Then
                  Dim p As gs_Size
                  s = c.Substring(i)
                  s = s.Substring(0, s.Length - 4)
                  i = InStr(s, "_x_")
                  p.Width = CSng(s.Substring(0, i - 1))
                  p.Height = CSng(s.Substring(i + 2))
                  PSizes.Add(p, c)
               End If
            End If
         Next
      End Using
   End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks for your help.&lt;/P&gt;&lt;P&gt;I now need to use the paper sizes.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 16:07:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3275947#M57887</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-28T16:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276009#M57888</link>
      <description>&lt;P&gt;You can create a global variable using CIL but I do not think you can in VB.NET&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 17:39:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276009#M57888</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2011-12-28T17:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276075#M57889</link>
      <description>&lt;P&gt;we may be thinking of different things but I use&lt;STRONG&gt; Public&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 19:14:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276075#M57889</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-28T19:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276129#M57890</link>
      <description>&lt;P&gt;We may be a cross-purposes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can define variables as Public, in which case they can be accessed across different classes and modules.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 20:26:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276129#M57890</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-28T20:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276305#M57891</link>
      <description>&lt;P&gt;What you are calling a variable still has to be accessed through a object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In VB when you use a&amp;nbsp;Module which is just a shared class it uses &lt;A href="http://msdn.microsoft.com/en-us/library/xz7s1h1x.aspx" target="_self"&gt;Type Promotion &lt;/A&gt;&amp;nbsp;to promote the members to namespace scope, but create a class with the same name and you have to type module name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only declarations allowed at namespace level are module, interface, class, delegate, enumeration, and structure declarations.&lt;/P&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 23:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276305#M57891</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2011-12-28T23:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276471#M57892</link>
      <description>&lt;P&gt;We are sort of getting away from the point. Thanks anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2011 09:31:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/3276471#M57892</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-29T09:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Printer Paper Sizes</title>
      <link>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/6861752#M57893</link>
      <description>Sorry for necro post... How do this function on VBA? If it possible...</description>
      <pubDate>Wed, 08 Feb 2017 05:46:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/printer-paper-sizes/m-p/6861752#M57893</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-08T05:46:02Z</dc:date>
    </item>
  </channel>
</rss>

