2013 Inventor Viewer PrintToFile() Prints to Printer.

2013 Inventor Viewer PrintToFile() Prints to Printer.

Anonymous
Not applicable
580 Views
1 Reply
Message 1 of 2

2013 Inventor Viewer PrintToFile() Prints to Printer.

Anonymous
Not applicable

What the heck?!!

 

The 2013 Inventor Viewer PrintToFile(<FileName>) procedurePrints to the printer.and not the file.

 

2011 worked fine,  Same code used.  2013 fails to print to the file, and prints to the printer instead.

 

Pulling what little hair I have left out over this one.

 

--- Shortened version of code follows ---

 

If oView.FileName = "" Then Exit Sub

Dim oDwg As IV.ApprenticeServerDrawingDocument = CType(oView.ApprenticeServerDocument, IV.ApprenticeServerDrawingDocument)

 

Dim oPrnt As IV.ApprenticeDrawingPrintManager = CType(oView.ApprenticeServerDocument.PrintManager, IV.ApprenticeDrawingPrintManager)

 

oView.Interactive = False

 

With oPrnt
  .SetCurrentView(oView.ClientView)
  .Printer = "PDF File Creator"
  '.Printer = "\\SERVER05\Kyocera Mita KM-4035"

  Dim oSheet As IV.Sheet = oDwg.Sheets(1)

  .SetSheetRange(1, 1)
  .PaperSize = InventorApprentice.PaperSizeEnum.kPaperSizeLetter
  .Orientation = InventorApprentice.PrintOrientationEnum.kLandscapeOrientation
  ScaleMode = IV.PrintScaleModeEnum.kPrintBestFitScale  

  .PrintToFile("C:\PDF_Home\Sheet-1.ps")
End With

0 Likes
Accepted solutions (1)
581 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Sorry to alarm anyone.  The problem was run-time and difficult to debug.

 

Someone set their default PDF output folder in my app to a name different from that which existed.

 

In my code (Ported from VB6) there was a "On Error Resume Next"  in the PS (Postscript) output loop.

When the non-existing folder name as part of the full output full name was passed to 

oPrnt.PrintToFile(<fullfilename>) it threw an error, but skipped the problem and moved on to the next line.

 

Result no file was created and there was no error.

 

I repaired my problem by updating the "on error resume next" statement to a "Try, Catch, End Try" structure
and putting in a check for the existence of the default output PDFfolder.

 

My updated "Drawings_to_PDF" app now works with the 2013 Inventor Viewer ocx. as it should

 

0 Likes