So there is plenty of information floating around that enables coders to export/save a file as a PDF. My question is how can control the options for my export?
This is the code that I've been using from here
My question pertains to the highlighted marks. How to I know what the other options are? I see when I debug that there are 40 items in my options object but to access them I need to know the text based version of the property. Does anybody own a list of available options for PDF?
Ultimately, what I want to do is limit the layers on my PDF. More or less "flatten" the image so my layers don't show up
Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Dim PDFAddIn As TranslatorAddIn Set 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 Set oDocument = ThisApplication.ActiveDocument Dim oContext As TranslationContext Set oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = kFileBrowseIOMechanism ' Create a NameValueMap object Dim oOptions As NameValueMap Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap ' Create a DataMedium object Dim oDataMedium As DataMedium Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium ' Check whether the translator has 'SaveCopyAs' options If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then ' Options for drawings... oOptions.Value("All_Color_AS_Black") = 0 'oOptions.Value("Remove_Line_Weights") = 0 'oOptions.Value("Vector_Resolution") = 400 'oOptions.Value("Sheet_Range") = kPrintAllSheets 'oOptions.Value("Custom_Begin_Sheet") = 2 'oOptions.Value("Custom_End_Sheet") = 4 End If 'Set the destination file name oDataMedium.FileName = "c:\temp\" & Left(DocumentObject.DisplayName, Len(DocumentObject.DisplayName) - 4) & " (REV " & ".pdf" 'Publish document.
Came across this when looking for some info on Exporting inventor files to 3D pdf. Not sure if you got your answer somewhere else, but here is what I have used.
Attached is a little bit of code that will output the NameValueMap options code used in your example to the immediate window.
Just pass the oOptions NameValueMap into the PrintNameValueMapCode sub
Call PrintNameValueMapCode(oOptions)
Public Sub PrintNameValueMapCode(ByRef oOptions As Inventor.NameValueMap, _ Optional ByRef strName As String = "", _ Optional ByRef lngRecursion As Long = 0) For i = 1 To oOptions.Count If TypeName(oOptions.Item(i)) = "NameValueMap" Then Debug.Print Indent(lngRecursion + 1); "'"; oOptions.Name(i); " NameValueMap settings" Call PrintNameValueMapCode(oOptions.Item(i), oOptions.Name(i), lngRecursion + 1) Else Debug.Print Indent(lngRecursion); "o"; strName; "Options.Value("""; oOptions.Name(i); """) = "; oOptions.Item(i) End If Next i End Sub Public Function Indent(ByRef lngCount As Long) As String For i = 1 To lngCount Indent = Indent + " " Next i End Function