print drawing as pdf



i have to create a pdf (11 x 17 size ) through printout object. Below i mentioned my code. Anybody can help me to resolve this one. while debugging, it is not showing any error. but it is not creating pdf file.



Dim objApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("solidedge.application")
        Dim objDoc As SolidEdgeDraft.DraftDocument = objApp.ActiveDocument
        Dim objsheet As SolidEdgeDraft.Sheet = objDoc.ActiveSheet
        Dim DraftPrinter As SolidEdgeDraft.DraftPrintUtility = objApp.GetDraftPrintUtility
        Dim path As String = objDoc.FullName
        Dim path1 As String = path.Substring(0, path.Length - 4) & ".pdf"

        DraftPrinter.Printer = "CutePDF Writer"
        DraftPrinter.PrintAsBlack = True
        DraftPrinter.AutoOrient = False
        DraftPrinter.Orientation = DraftPrintOrientationConstants.igDraftPrintLandscape
        DraftPrinter.SheetsPerPage = SolidEdgeDraft.DraftPrintSheetsPerPageConstants.igSingleSheet
        DraftPrinter.BestFit = False
        DraftPrinter.SingleSheetScale = 1.0
        DraftPrinter.PaperSize = DraftPrintPaperSizeConstants.igDraftPrintPaperSize_Custom
        DraftPrinter.PaperHeight = 11.0
        DraftPrinter.PaperWidth = 17.0
        DraftPrinter.PrintToFilePath = path1



i tried this one also.


  Call objDoc.PrintOut("CutePDF Writer", Orientation:=DraftPrintOrientationConstants.igDraftPrintLandscape, ColorAsBlack:=True, PrintToFile:=True, OutputFileName:=path1, PaperSize:=PaperSizeConstants.igAnsiBWide, Scale:=1, Collate:=True, NumCopies:=1)

while debugging, it creates the pdf file but i can't able to open it. "Not supported format"


anybody can please check and tell my mistake...


Re: print drawing as pdf

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom


you could also use the SaveAs() method using an .PDF extension.

There as several Global Parameters (GetGlobalParameter(), SetGlobalParameter() ) introduced in ST7.

See ApplicationGlobalConstants enumeration.


VS2015, SE ST10

Re: print drawing as pdf

Valued Contributor
Valued Contributor



In your code, draft document not added to printer. after adding document type or sheet, i can open & see PDF.


but best way to conver pdf, use "SaveAs() method" (JB referred).


objDoc.SaveAs((objDoc.Path) & "\" & IO.Path.GetFileNameWithoutExtension(objDoc.Name) & ".pdf")