Hi @alan.wedge. Here is an iLogic rule you can try out for that task. I customized that settings within to match the settings in the image you posted. It also has a built-in checker, which checks if that PDF file already exists, and if it does, it pauses to ask if you want to overwrite it, or leave the existing one alone (therefore not exporting it again).
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("This Rule only works on Drawing Documents. Exiting Rule.", vbExclamation, "iLogic")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
If oDDoc.FileSaveCounter = 0 Then
MsgBox("You must save the drawing file before exporting it to PDF.", vbCritical, "iLogic")
Exit Sub
End If
Dim sPath As String = System.IO.Path.GetDirectoryName(oDDoc.FullFileName)
Dim sDirSep As Char = System.IO.Path.DirectorySeparatorChar
Dim sStockNum As String = oDDoc.PropertySets.Item(3).Item("Stock Number").Value
Dim sNewFullName As String = sPath & sDirSep & sStockNum & ".pdf"
ExportToPDF(oDDoc, sNewFullName)
End Sub
Sub ExportToPDF(oDrawing As DrawingDocument, sNewFullFileName As String)
Dim oPDF As TranslatorAddIn
oPDF = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Dim oTO As TransientObjects = ThisApplication.TransientObjects
Dim oContext As TranslationContext = oTO.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim oOptions As NameValueMap = oTO.CreateNameValueMap
Dim oDataMedium As DataMedium = oTO.CreateDataMedium
If System.IO.File.Exists(sNewFullFileName) = True Then
oAns = MsgBox("A PDF file with this name already exists." & vbCrLf &
"Do you want to overwrite it with this new one?",vbYesNo + vbQuestion + vbDefaultButton2, "PDF ALREADY EXISTS")
If oAns = vbNo Then Exit Sub
End If
oDataMedium.FileName = sNewFullFileName
If oPDF.HasSaveCopyAsOptions(oDrawing, oContext, oOptions) Then
oOptions.Value("Publish_All_Sheets") = 1 ' 0 = False, 1 = True
oOptions.Value("All_Color_AS_Black") = 0 ' 0 = False, 1 = True
oOptions.Value("Vector_Resolution") = 2400 ' DPI
oOptions.Value("Remove_Line_Weights") = 0 ' 0 = False, 1 = True
oOptions.Value("Launch_Viewer") = 0 ' 0 = False, 1 = True
End If
Try
oPDF.SaveCopyAs(oDrawing, oContext, oOptions, oDataMedium)
Catch e As Exception
Logger.Error("Error using SaveCopyAs method." & vbCrLf & e.Message & vbCrLf & e.StackTrace)
End Try
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)