Missing printer paper sizes?

Discussion in 'AutoCAD' started by kevink, Jan 21, 2004.

  1. kevink

    kevink Guest

    This is the code used to return the available paper sizes from an HP 1055cm plotter.

    Private Sub cmbPlotDevice_Click()

    Dim x As Integer
    PltDevice = cmbPlotDevice.Text
    ActiveDocument.ActiveLayout.RefreshPlotDeviceInfo
    ' acadApp.ActiveDocument.ModelSpace.Layout.ConfigName = PltDevice
    acadApp.ActiveDocument.ActiveLayout.ConfigName = PltDevice
    ActiveDocument.ActiveLayout.RefreshPlotDeviceInfo
    cmbPaperSize.Clear
    'plotMedia = acadApp.ActiveDocument.ModelSpace.Layout.GetCanonicalMediaNames()
    plotMedia = ActiveDocument.ActiveLayout.GetCanonicalMediaNames()
    For x = LBound(plotMedia) To UBound(plotMedia)
    cmbPaperSize.AddItem plotMedia(x)
    Next
    isDevice = True

    End Sub

    It is returning only user sizes. This code works with HP laser printers and with Xerox color printers.

    Any Ideas what is wrong.
     
    kevink, Jan 21, 2004
    #1
  2. kevink

    Joe Sutphin Guest

    Kevin,

    Give this a try and see if it helps get you what you want.

    Joe
    --
    Public Sub GetPaperSizesAndNames()
    Dim Layout As AcadLayout
    Dim Width As Double
    Dim Height As Double
    Dim Margins As Variant
    Dim MediaNames As Variant
    Dim PlotDeviceNames As Variant

    With ThisDrawing
    .ActiveSpace = acPaperSpace
    Set Layout = .ActiveLayout
    End With

    With Layout
    MediaNames = .GetCanonicalMediaNames
    Dim Index As Integer
    For Index = 0 To UBound(MediaNames) - 1
    .CanonicalMediaName = MediaNames(Index)
    'get the current paper size
    .GetPaperSize Width, Height
    'format it to english units - AutoCAD returns the number in metric
    Width = Format(Width, "0000.0") / 25.4: Height = Format(Height,
    "0000.0") / 25.4
    Debug.Print .CanonicalMediaName & vbTab & "Width: " & Width & vbTab &
    "Height: " & Height
    'Debug.Print MediaNames(index)
    Next Index

    'display plot device names
    PlotDeviceNames = .GetPlotDeviceNames

    For Index = 0 To UBound(PlotDeviceNames) - 1
    Debug.Print "PlotDevice: " & PlotDeviceNames(Index)
    Next Index
    End With

    With ThisDrawing
    .ActiveSpace = acModelSpace
    Set Layout = .ActiveLayout
    End With
    End Sub
     
    Joe Sutphin, Jan 22, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.