Reply

print drawing as pdf

Hi,

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
        DraftPrinter.PrintOut()

 

 

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...

2 REPLIES

Re: print drawing as pdf

Hi,

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

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

See ApplicationGlobalConstants enumeration.

regards

JB
VS2015, SE ST10

Re: print drawing as pdf

Hi,

 

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")