PdfAddin Option "Launch_Viewer" = True or = false: Not set in option dialog.

PdfAddin Option "Launch_Viewer" = True or = false: Not set in option dialog.

bradeneuropeArthur
Mentor Mentor
1,936 Views
5 Replies
Message 1 of 6

PdfAddin Option "Launch_Viewer" = True or = false: Not set in option dialog.

bradeneuropeArthur
Mentor
Mentor

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.

 

Launch_Viewer.PNG

 

 

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 module

After the code it is still not checked an the pdf is not checked an not previewed.

 

 

Launch_Viewer.PNG

 

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 & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Accepted solutions (2)
1,937 Views
5 Replies
Replies (5)
Message 2 of 6

MechMachineMan
Advisor
Advisor
Accepted solution

Hi,

 

It's kind of funny, but it doesn't look like they show options for PDF in their documentation to begin with...

 

http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-25D24E28-7517-4903-8AEE-123F8C71A89E

 

Anwyays, pdfs can just be viewed after creation using the generics

 

'iLogic
ThisDoc.Launch("C:\Filename.pdf")
'vb.net
Process.Start("C:\Filename.pdf")
'vba
Shell "C:\Filename.pdf"

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 6

bradeneuropeArthur
Mentor
Mentor

Hi Curtis,

 

Thank you this works too.

But I think Autodesk should provide the API for this issue.

 

So I will leave it open, because you solved the problem with a workaround, and that is good.

 

Do you agree?

 

Thank you again

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 4 of 6

bradeneuropeArthur
Mentor
Mentor

Hi,

 

I have put into the Ideastation, so I will Check it as solved.

 

https://forums.autodesk.com/t5/inventor-ideas/pdf-creation-quot-launch-viewer-quot-needs-to-be-imple...

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 5 of 6

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Hi All,

 

Also this programmer can make a mistake.

I have made the Pdf Export to the wrong AddIn id.

 

The Correct one should be:

 

PDFAddIn = oInvApp.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

AND NOT

PDFAddIn = oInvApp.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")

So Solved by mistake and  it is working.

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 6 of 6

pavel.rybar
Contributor
Contributor

I solve opposite problem. The PDFAddIn.SaveCopyAs method opens created pdf in viewer, and there is no easy way how to disable this behaviour. Killing Acrobat process is bad due to other opened docs in Acrobat.

I am using Inventor 2018, and this addin: .ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

oOptions.Value("Launch_Viewer") = 0 

oOptions.Value("Launch_Viewer") = false

not working