- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
When I am using Vba or Vb.net to "launch_Viewer" of the pdf file after creation, it is not previewed.
I have seen that the option in the API is set but it is not checked in the option dialogbox.
Something has changed regarding this since inventor 2012.
With inventor 2012 it was working correctly.
But with inventor 2018 it is not working anymore.
After the code it is still not checked an the pdf is not previewed.
Module MdlExport
Public Sub ExportPdf(oInvApp As Inventor.Application, strExportRoot As String, strSuffix As String)
' Get the PDF translator Add-In.
Dim PDFAddIn As TranslatorAddIn
PDFAddIn = oInvApp.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
oDocument = oInvApp.ActiveDocument
Dim fi As System.IO.FileInfo
fi = New System.IO.FileInfo(oDocument.FullFileName)
Dim strDirPath As String
strDirPath = fi.DirectoryName
Dim strDirName As String
strDirName = fi.Directory.Name
Dim strFileNameNoExtension As String
strFileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(oDocument.FullFileName)
'MsgBox(strFileNameNoExtension)
Dim strFileRootPath As String
strFileRootPath = System.IO.Path.GetPathRoot(oDocument.FullFileName)
Dim strNewDirFilepath As String
strNewDirFilepath = Replace(strDirPath, strFileRootPath, strExportRoot & ":\")
'MsgBox(strFileNameNoExtension)
Dim oContext As TranslationContext
oContext = oInvApp.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism ' kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = oInvApp.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
oDataMedium = oInvApp.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
oOptions.Value("Launch_Viewer") = true
end if
Try
MkDir(strNewDirFilepath)
Catch ex As Exception
End Try
'Set the destination file name
oDataMedium.FileName = strNewDirFilepath & "\" & strFileNameNoExtension & strSuffix & ".Pdf"
'Publish document.
Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
end sub
end moduleAfter the code it is still not checked an the pdf is not checked an not previewed.
Any idea how to preview the pdf.
Remarks:
The same issue is seen with the DwfAddin.
This could be a bug.
Please Autodesk take this in review If this is a bug.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Solved! Go to Solution.