How to plot dwg to pdf file in VBA?

Hi 
1. How to plot dwg to pdf file in VBA?
2. Any plot-to-pdf software is best?

Thanks

Comments

  •  Her is sample code,  print with PDFCreator from AutoCAD.
    Anybody can modify the code to run in BricsCAD!
    Thanks

    Private withevents mypdf as PDFCreator.clsPDFCreator

    private readystate as boolean = true
    private sub pdf_create()
    mypdf = New PDFCreator.clsPDFCreator
    If mypdf.cStart("/NoProcessingAtStartup") = False Then
    mypdf.cClose()
    mypdf = Nothing
    Shell("taskkill /f /im PDFCreator.exe", AppWinStyle.Hide, True)
    mypdf = New PDFCreator.clsPDFCreator
    mypdf.cStart("/NoProcessingAtStartup")
    End If
    Dim dp As String = mypdf.cDefaultPrinter
    With mypdf
    .cDefaultPrinter = "PDFCreator"
    .cClearCache()
    .cOption("UseAutosave") = 1
    .cOption("UseAutosaveDirectory") = 1
    .cOption("AutosaveDirectory") = "C:\Your\Directory\Path" 'Make sure you leave off the trailing \
    .cOption("AutosaveFormat") = 0
    .cOption("AutosaveFilename") = "your_file_name" 'Make sure you leave off the .pdf
    .cOption("PDFUseSecurity") = 1
    .cOption("PDFOwnerPass") = 1
    .cOption("PDFOwnerPasswordString") = "your_pass"
    .cOption("PDFDisallowCopy") = 1
    .cOption("PDFDisallowModifyContents") = 1
    .cOption("PDFDisallowModifyAnnotations") = 1
    .cOption("PDFHighEncryption") = 1
    .cPrintFile("C:\Path\to\CAD\File.dwg")
    .cPrinterStop = False
    readystate = False
    Do While Not readystate
    Application.DoEvents()
    Loop
    .cPrinterStop = True
    .cDefaultPrinter = dp
    .cCloseRunningSession()
    .cClose()
    End With
    mypdf = Nothing
    end sub
    Private Sub pdf_ready() Handles mypdf.eReady
    readystate = True
    End Sub
This discussion has been closed.