Hello together,
is there a complete sample for printing on different printers, paper size, scale mode, sheets, orientation, color, line weights, preview and paper source?
Thank you very much
Georg
Solved! Go to Solution.
Solved by saseendrankombath. Go to Solution.
This code is used for printing to 3 different printers, please note that the identification of paper size and oreintation is done by checking the boarder size which I am using. change it accordingly.
Private Sub oButtonAutoPrint_OnExecute(Context As Inventor.NameValueMap) Handles oButtonAutoPrint.OnExecute Try Dim oDoc As Inventor.DrawingDocument oDoc = m_inventorApplication.ActiveDocument Dim oSheet As Inventor.Sheet oSheet = oDoc.ActiveSheet Dim oPM As Inventor.PrintManager oPM = oDoc.PrintManager Dim strPrinter As String = Nothing If oSheet.Border.Name = "IP-A4R" Then oPM.Printer = "HP LaserJet 1022" oPM.ColorMode = PrintColorModeEnum.kPrintGrayScale oPM.PaperSize = PaperSizeEnum.kPaperSizeA4 oPM.Orientation = PrintOrientationEnum.kLandscapeOrientation oPM.NumberOfCopies = 1 oPM.scalemode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oPM.printrange = Inventor.PrintRangeEnum.kPrintCurrentSheet oPM.RemoveLineWeights = True ElseIf oSheet.Border.Name = "IP-A4" Then oPM.Printer = "HP LaserJet 1022" oPM.ColorMode = PrintColorModeEnum.kPrintGrayScale oPM.PaperSize = PaperSizeEnum.kPaperSizeA4 oPM.Orientation = PrintOrientationEnum.kPortraitOrientation oPM.NumberOfCopies = 1 oPM.scalemode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oPM.printrange = Inventor.PrintRangeEnum.kPrintCurrentSheet oPM.RemoveLineWeights = True ElseIf oSheet.Border.Name = "IP-A3" Then oPM.Printer = "HP Officejet Pro K850 Series" oPM.ColorMode = PrintColorModeEnum.kPrintColorPalette oPM.PaperSize = PaperSizeEnum.kPaperSizeA3 oPM.Orientation = PrintOrientationEnum.kLandscapeOrientation oPM.NumberOfCopies = 1 oPM.scalemode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oPM.printrange = Inventor.PrintRangeEnum.kPrintCurrentSheet oPM.RemoveLineWeights = True ElseIf oSheet.Border.Name = "IP-A2" Then oPM.Printer = "HP Designjet 500 42+HPGL2 Card" oPM.ColorMode = PrintColorModeEnum.kPrintColorPalette oPM.PaperSize = PaperSizeEnum.kPaperSizeA2 oPM.Rotate90Degrees = True oPM.Orientation = PrintOrientationEnum.kPortraitOrientation oPM.NumberOfCopies = 1 oPM.scalemode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oPM.printrange = Inventor.PrintRangeEnum.kPrintCurrentSheet oPM.RemoveLineWeights = True ElseIf oSheet.Border.Name = "IP-A1" Then oPM.Printer = "HP Designjet 500 42+HPGL2 Card" oPM.ColorMode = PrintColorModeEnum.kPrintColorPalette oPM.PaperSize = PaperSizeEnum.kPaperSizeA1 oPM.Rotate90Degrees = True oPM.Orientation = PrintOrientationEnum.kPortraitOrientation oPM.NumberOfCopies = 1 oPM.scalemode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oPM.printrange = Inventor.PrintRangeEnum.kPrintCurrentSheet oPM.RemoveLineWeights = True ElseIf oSheet.Border.Name = "IP-A0" Then oPM.Printer = "HP Designjet 500 42+HPGL2 Card" oPM.ColorMode = PrintColorModeEnum.kPrintColorPalette oPM.PaperSize = PaperSizeEnum.kPaperSizeA0 oPM.Rotate90Degrees = True oPM.Orientation = PrintOrientationEnum.kPortraitOrientation oPM.NumberOfCopies = 1 oPM.scalemode = Inventor.PrintScaleModeEnum.kPrintBestFitScale oPM.printrange = Inventor.PrintRangeEnum.kPrintCurrentSheet oPM.RemoveLineWeights = True End If oPM.SubmitPrint() If oSheet.Border.Name = "IP-A2" Then MsgBox("Please Load A2 Paper (Portrait) on " & strPrinter, MsgBoxStyle.Information, " Automated Printing") ElseIf oSheet.Border.Name = "IP-A1" Then MsgBox("Please Load A1 Paper (Portrait) on " & strPrinter, MsgBoxStyle.Information, " Automated Printing") ElseIf oSheet.Border.Name = "IP-A0" Then MsgBox("Please Load A0 Paper (Roll) on " & strPrinter, MsgBoxStyle.Information, " Automated Printing") End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub