05-26-2023
12:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-26-2023
12:27 AM
I forgot to add the pdf converter that is used in this code. It will export the .pdf file to the folder of the active document. So here it is the code:
'Pdf exporter code to drawing folder (without arraylist) '-------------------------------------------------------------------- 'File location Dim ExportPath As String = ThisDoc.Path 'Check of het al bestaat If String.IsNullOrEmpty(ExportPath) Then MsgBox("De file bestaat niet!" _ & vbLf & "Sla de file eerst op",64, "Error message") Return End If 'Filename ExportFilename = ThisDoc.FileName(False)+".pdf" 'without extension '-------------------------------------------------------------------- 'Pdf settings (Not written by Michael Stienstra. Unfortunately source unknown) 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 'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then 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 'End If '-------------------------------------------------------------------- 'File location oDataMedium.FileName = ExportPath & "\" & ExportFilename Try 'Create document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) Catch 'Error respons message MessageBox.Show("An error has occurred", "Error") bError = True End Try