- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Problem Printing to PDF from Ilogic 2018
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-------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @AlanBrock9115,
Successfully PDF published and opened in Adode Acrobat DC with little changes in iLogic code.
Currently, I am using Inventor 2018.1.2
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 = "C:\Temp\Exacmple2.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
Go through the following video for more details.
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Chandra
Thank you for your reply
I ran you code which works as does mine and it produces a PDF
The problem is that in a multi set PDF you cannot extract any pages or even save as in Adode Acrobat DC
I get a cannot read error 114 come up as I extract
I have included a drawing set
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @AlanBrock9115,
You mean to say that attached PDF can not open in Adobe Acrobat reader DC.
I am able to open attached PDF in Adobe reader DC. Find the below attached screenshot of the same.
I suspect that Adobe Acrobat Reader DC may be corrupted. It may requires repair or reinstallation of Adobe Acrobat Reader DC.
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I tried viewing the attached PDF file and also get the 114 error from Adobe Reader DC when doing a save as.
I then tried with my installed Inventor 2018 and a multi-page IDW drawing with 10 sheets.
I used the following iLogic rule, mostly copied from your post, but put through Visual Studio to ensure there were no syntactical errors and modified slightly for my local file system:
Sub Main()
Dim oDrawing As DrawingDocument = CType(ThisApplication.ActiveDocument, DrawingDocument)
Dim oMySheetCount As Long = oDrawing.Sheets.Count
Dim oFileName As String = ThisDoc.FileName(False)
Dim oRevNum As String = CStr(iProperties.Value("Project", "Revision Number"))
Dim oDescription As String = CStr(iProperties.Value("Project", "Description"))
Dim oPDFAddIn As TranslatorAddIn = CType(ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}"), TranslatorAddIn)
Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange
oOptions.Value("Custom_Begin_Sheet") = 2
oOptions.Value("Custom_End_Sheet") = 4
Dim oDataMedium As DataMedium = ThisApplication.TransientObjects.CreateDataMedium
'Set the PDF target file name
oDataMedium.FileName = "D:\Temp\Download\" & oFileName & ".pdf"
Try
'Publish document
oPDFAddIn.SaveCopyAs(oDrawing, oContext, oOptions, oDataMedium)
Catch ex As Exception
End Try
Exit Sub
End SubThis rule saves a 3 page PDF and this PDF can be opened in Adobe Reader DC and saved as with no problems.
My Inventor is the latest version:
So it works for me with the current Inventor and this iLogic rule on my multi-sheet drawing.
Regards,
Jens Bejer Pedersen
Developer, Symetry A/S