Message 1 of 5
Problem Printing to PDF from Ilogic 2018
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys
I have just upgraded to 2018.1 and have a global ilogic script (thanks to Curtis Waguespack). I made the tweaks to the code so that it produced PDFs which worked fine. The problem comes when opening the PDF set and trying to extract a page or save as you get a cannot read file (114) error. The PDF behaves normally in all other respects.
If I print to PDF from Inventor it works fine and using the changed ilogic code in 2017 it also works.
I have included the code and hoping someone may be able to help.
We use Adobe Acrobat DC.
Many Thanks
trigger = iTrigger0 Dim oDrawing As DrawingDocument oDrawing = ThisApplication.ActiveDocument Dim osheet As Sheet oPath = iProperties.Value("Summary", "Subject") oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") oDescription = iProperties.Value("Project", "Description") oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _ ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium oMySheetCount = oDrawing.Sheets.Count oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 1 oOptions.Value("Vector_Resolution") = 400 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets oOptions.Value("Custom_Begin_Sheet") = iPageNumber oOptions.Value("Custom_End_Sheet") = iPageNumber oOptions.Value("Custom_Begin_Sheet") = 2 oOptions.Value("Custom_End_Sheet") = 4 'get PDF target folder path oFolder = Left(oPath, InStrRev(oPath, "\"))' & "2521-Arapuni Diversion Gate Upgrade" 'Check for the PDF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'Set the PDF target file name oDataMedium.FileName = oFolder & "\" & oFileName & _ "-SET-"& oDescription &"["& oRevNum &"]" & ".pdf" On Error Goto handlePDFLock 'Publish document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) ThisApplication.CommandManager.ControlDefinitions.?Item("AppFilePrintCmd").Execute Exit Sub handlePDFLock: MessageBox.Show("PDF could not be saved, most likely someone has it open ", "No PDF for you " & ThisApplication.GeneralOptions.UserName & "!") Resume Next handleXLSLock: MessageBox.Show("No XLS", "iLogic") Resume Next '------end of iLogic-------