dont lock the pdf (
DOSSIER = ThisDoc.Path POSITION1 = InStrRev(DOSSIER, "\") POSITION2 = Right(DOSSIER, Len(DOSSIER) - POSITION1) oFileName = ThisDoc.FileName(False) 'without extension oFolder = "I:\DOCUMENTS\ARTICLES\" & POSITION2 & "\" myFile1 = oFolder & oFileName & ".PDF"
PDFTranslator = ThisApplication.ApplicationAddIns.ItemById( _ "{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Dim doc As DrawingDocument doc = ThisApplication.ActiveDocument
Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As dataMedium oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
If PDFTranslator.HasSaveCopyAsOptions(doc, oContext, options) Then
'All available options oOptions.Value("All_Color_AS_Black") = 1 'options.Value("Animations") = 0 'options.Value("BOM_Parts_Only") = 1 'options.Value("BOM_Structured") = 1 'options.Value("Custom_Begin_Sheet") = 1 'options.Value("Custom_End_Sheet") = 1 'options.Value("Enable_Large_Assembly_Mode") = 0 'oOptions.Value("Enable_Markup_Edits") = 1 'oOptions.Value("Enable_Markups") = 1 'oOptions.Value("Enable_Measure") = 1 'options.Value("Enable_Printing") = 1 'options.Value("Facet_Quality") = 69379 'options.Value("iAssembly_3D_Models") = 0 'options.Value("iAssembly_All_Members") = 0 'options.Value("Include_Empty_Properties") = 0 'options.Value("Include_Sheet_Tables") = 1 'options.Value("Instructions") = 0 'options.Value("iPart_3D_Models") = 0 'options.Value("iPart_All_Members") = 0 'options.Value("Launch_Viewer") = 0 'options.Value("Output_Path") = "c:\Temp\dwgout.pdf" 'options.Value("Override_Sheet_Color") = 0 oOptions.Value("Password") = "1234" 'options.Value("Publish_3D_Models") = 0 'options.Value("Publish_All_Sheets") = 0 'options.Value("Publish_Component_Props") = 1 'options.Value("Publish_Mass_Props'") = 1 'options.Value("Publish_Mode") = 62721 'options.Value("Publish_Screenshot") = 0 'options.Value("Screenshot_DPI") = 96 'options.Value("Sheet_Color") = 14085613 'options.Value("Sheet_Metal_Flat_Pattern") = 0 'options.Value("Sheet_Metal_Part") = 1 'options.Value("Sheet_Metal_Style_Information") = 0 'options.Value("Sheet_Range") = 14081 'options.Value("Vector_Resolution") = 400 'options.Value("Weldment_Preparation") = 0 'options.Value("Weldment_Symbol") = 0 End If
'Set the destination file name NOM = oFolder & oFileName & ".PDF" oDataMedium.FileName = NOM
'Publish document. Call PDFTranslator.saveCopyAs(doc, oContext, oOptions, oDataMedium)