Hi @drafting3QE6L
You could give this example a try.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Imports System.IO
'Imports System.Windows.Forms
Sub main
' Define folder browse dialog
Dim Dialog = New FolderBrowserDialog()
' Set options for folder browser dialog
'set initial folder location
Dialog.SelectedPath = "C:\Temp\"
Dialog.ShowNewFolderButton = False
Dialog.Description = "Choose the folder that contains the drawings..."
' Show dialog box
If DialogResult.OK = Dialog.ShowDialog() Then
' User clicked 'ok' on dialog box - capture the export path
oFolder = Dialog.SelectedPath & "\"
Else
' User clicked 'cancel' on dialog box - exit
Return
End If
Dim oList As New ArrayList
Dim oDir As New DirectoryInfo(oFolder)
iCount = 0
For Each oFile As IO.FileInfo In oDir.GetFiles("*idw", IO.SearchOption.TopDirectoryOnly)
oList.Add(oFile.FullName)
iCount = iCount + 1
Next
oRUSure = MessageBox.Show(iCount & " drawings found... This could take a while, are you sure you want to run this batch?", _
"iLogic", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If oRUSure = vbNo Then
Return 'exit rule
End If
oPDF_Folder = oFolder & "PDF Folder\"
'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oPDF_Folder) Then
System.IO.Directory.CreateDirectory(oPDF_Folder)
End If
For Each oItem In oList
oDoc = ThisApplication.Documents.Open(oItem, True)
Call Export_PDF(oDoc, oPDF_Folder)
oDoc.Close()
Next
MessageBox.Show("PDF export is complete.", "iLogic", MessageBoxButtons.OK, MessageBoxIcon.Information)
ThisDoc.Launch(oPDF_Folder)
End Sub
Sub Export_PDF(oDoc As Document, oPDF_Folder As String)
oName = IO.Path.GetFileNameWithoutExtension(oDoc.Fullfilename)
oPDF = oPDF_Folder & oName & ".pdf"
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
'set PDF Options
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange
'Set the PDF target file name
oDataMedium.FileName = oPDF
Try
'Publish document
oPDFAddIn.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium)
Catch
Logger.Info("Error writing out PDF... " & oPDF)
End Try
End Sub
