Message 1 of 2
submitprint gives error while printing IDW from weldment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
A made a function wich prints the IDW from a myDoc as ApprenticeServerDrawingDocument.
All goes well, except when it is a drawing made from a weldment iam.
A COMExceptio is thrown with HRESULT: 0x8000FFFF (E_UNEXPECTED)), _COMPlusExceptionCode = -532462766
I'm completely stuck in finding a solution, is this perhaps a bug?
I would be very glad with any kind of help in solving this.
Private Function PrintDocument(ByRef myDoc As ApprenticeServerDrawingDocument, _ ByRef PS As PrintSheet, _ ByVal myOrientation As PrintOrientationEnum, _ ByVal SheetNumber As Integer) As Boolean Dim oDrgPrintMgr As ApprenticeDrawingPrintManager Dim printed As Boolean = False Dim ExtraPrint As Integer = 0 Dim H As String Try If PS.NrOfCopies > 0 Then If PS.Department.Equals("AV") Then ' RL 20070323 extra prints for Arbeitsvorbereitung H = GetCustProp(CType(myDoc, ApprenticeServerDocument), SharedFunctions.PROPERTY_EXTRA_PRINT, String.Empty) If Not H.Equals(String.Empty) Then Try ExtraPrint = CInt(H) Catch ex As Exception ErrLog.Log("PrintDocument", ex.ToString, MsgType.Fault) End Try End If End If ErrLog.Log("Batch print", "printing " & myDoc.DisplayName & " " & PS.GetKey & " Sheet " & SheetNumber.ToString, ErrLog.MsgType.Info) Me.StatusBarPanelText.Text = "Printing: " & myDoc.FullFileName & " sheet: " & SheetNumber.ToString & " for " & PS.Department.ToString Me.StatusBarBP.Refresh() oDrgPrintMgr = DirectCast(myDoc.PrintManager, ApprenticeDrawingPrintManager) If Not oDrgPrintMgr Is Nothing Then With oDrgPrintMgr .Printer = PS.PrinterName .PaperSize = CType(PS.InvPaperSize, PaperSizeEnum) If .PaperSize = PaperSizeEnum.kPaperSizeCustom Then .PaperHeight = PS.PaperHeight .PaperWidth = PS.PaperWidth End If .PaperSource = PS.PaperSource .Orientation = myOrientation .NumberOfCopies = PS.NrOfCopies + ExtraPrint ' RL 20070323 extra print added .AllColorsAsBlack = PS.AllColorsAsBlack If PS.AllColorsAsBlack = False Then If PS.IsColorPrinter = False Then .ColorMode = PrintColorModeEnum.kPrintGrayScale Else .ColorMode = PrintColorModeEnum.kPrintColorPalette End If End If .ScaleMode = PrintScaleModeEnum.kPrintBestFitScale .PrintRange = PrintRangeEnum.kPrintSheetRange .SetSheetRange(SheetNumber, SheetNumber) Try .SubmitPrint() printed = True Catch nrex As NullReferenceException MsgBox(nrex.ToString, MsgBoxStyle.Exclamation, "PrintDocument") Catch cex As Runtime.InteropServices.COMException ErrLog.Log(cex.ToString, "PrintDocument") Catch ex As Exception ErrLog.Log(ex.ToString, "PrintDocument") End Try End With End If End If Catch ex As Exception ErrLog.Log("PrintDocument", ex.ToString, ErrLog.MsgType.Fault) Finally
End Try Return printed End Function
Regards,
Marcel