(изменено: Элис, 26 октября 2010г. 15:31:08)

Тема: Печать листа в PDF

Здравствуйте форумчане!!  Подскажите, пожалуйста!  Нужно напечатать лист в PDF.  хочу сделать с помощью выделенной области, к сожалению не работает, т.е.  PDF создает, но стандартный. Подскажите где я ошиблась!


  Sub PlotFromModelSpace()
Dim PtConfigs As AcadPlotConfigurations
Dim PlotConfig As AcadPlotConfiguration
Dim PtObj As AcadPlot
Dim BackPlot As Variant
Dim CanMedName As String
Dim CanMedNamelist As String
Dim mini As Double
Dim maxi As Double
Dim deltaX As Double
Dim deltaY As Double
Dim PathDoc  As String
Dim NameDoc  As String
Dim strnameold As String
Dim CanMedNameold As String
Dim PaperWidth As Double
  Dim PaperHeight As Double
    
    Dim RetVal
    Dim oShell
    Dim prevPrinter
    Dim temp As String, asd As String
    Dim list As ACADLayout
   Dim sBlStampName As String
   Dim ent As AcadEntity
   Dim blStamp As AcadBlockReference
   Dim koljpg As Integer
   Dim sN  As Integer
   Dim sysVarName As String
   Dim varData As Variant   
      
With ThisDrawing
Dim point1 As Variant, point2 As Variant

   point1 = .GetVariable("extmin")    
    
   ' point1 = ThisDrawing.Utility.GetPoint(, "Click the lower-left of the window to plot.")
    ReDim Preserve point1(0 To 1)   ' Change this to a 2D array by removing the Z position
    point1(0) = 0
    point1(1) = 100
        
 point2 = .GetVariable("extmax")

    ' point2 = ThisDrawing.Utility.GetPoint(, "Click the upper-right of the window to plot.")
    ReDim Preserve point2(0 To 1)   ' Change this to a 2D array by removing the Z position
  
     point2(0) = 300
     point2(1) = 100
BackPlot = .GetVariable("BACKGROUNDPLOT")
Set PtObj = .Plot
Set PtConfigs = .PlotConfigurations
PtConfigs.Add ("PDF")
Set PlotConfig = PtConfigs.Item("PDF")
With PlotConfig
.PlotType = acExtents
.RefreshPlotDeviceInfo
.ConfigName = "DWG To PDF.pc3"
.RefreshPlotDeviceInfo
.StandardScale = acScaleToFit
.RefreshPlotDeviceInfo
Dim plotFileName As String
Dim result As Boolean
Dim strname As String
Dim PlotDeviceName As String



strname = ThisDrawing.ActiveLayout.name + ".pdf"


 plotFileName = "D:\Temp\1\" + strname
 PlotDeviceName = "DWG To PDF.pc3"
   .SetWindowToPlot point1, point2
   .PlotType = acWindow
   .CenterPlot = True

End With

.Plot.PlotToFile plotFileName, PlotDeviceName
.Plot.DisplayPlotPreview acFullPreview
BackPlot = .GetVariable("BACKGROUNDPLOT")
.SetVariable "BACKGROUNDPLOT", 0

.SetVariable "BACKGROUNDPLOT", BackPlot

PtConfigs.Item("PDF").Delete
Set PlotConfig = Nothing

End With
End Sub

Re: Печать листа в PDF

Плохо знаком с темой печати.

Единственное, ты задаешь устройство печати "DWG To PDF.pc3" (драйвер автокада для печати в pdf, правильно?). Для него не предусмотрена печать в файл.

Поэтому, если используешь "DWG To PDF.pc3", то используй меод PlotToDevice.

И поищи, уверен такие вопросы уже решались.