Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Print PDF i-logic stoped working in 2018

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
409 Views, 3 Replies

Print PDF i-logic stoped working in 2018

Hi all,

 

My pring to pdf i-logic shows an error when printing to pdf since upgrading to Inventor 2018.

Has anyone had this error message and how did you fix it?

Code attached below;

thanks in advance

 

PRINT TO PDF ERROR.JPG

 

SyntaxEditor Code Snippet

Dim PDFAddIn As TranslatorAddIn
PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

' Check whether the translator has 'SaveCopyAs' options
If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 4800
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
End If

PDFDirectory = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension

If ThisDoc.Path =  "" Then
MessageBox.Show("PDF file not created, click Save button again for PDF creation.", "iLogic")
Return 'exit rule
Else
oDataMedium.FileName = PDFDirectory & "\" & oFileName & ".PDF"
End If

'Publish document.
PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
'Launch the PDF file in whatever application Windows is set to open this document type with
'i = MessageBox.Show("Preview the PDF file?", "PDF Preview",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
'If i = vbYes Then ThisDoc.Launch(oDataMedium.FileName)
3 REPLIES 3
Message 2 of 4
Xun.Zhang
in reply to: Anonymous

Hi @JaneFan, is there anything changed in Inventor 2018 for it?

Thanks!


Xun
Message 3 of 4
JaneFan
in reply to: Anonymous

Please try to change one argument in method HasSaveCopyAsOptions(), using Document instead of DataMedium. 

SyntaxEditor Code Snippet

If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then

 




Jane Fan
Inventor QA Engineer
Message 4 of 4
Anonymous
in reply to: JaneFan

Hi Jane,

 

That works great, thank you for your support. Smiley Happy

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report