ilogic to export pdf to folder,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have a few users, we all export PDFs to one folder (for purchasing) on our network.
I have found some samples here in the forum, but they do way more then I need.
Any direction would be helpful.
Outline:
Export PDF to folder , (F:\VENDOR), save as a current drawing name, over right existing file.
sample that is close??
'query user
question = MessageBox.Show("Is a .PDF Export To Monitor Required?", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
'set condition based on answer
If question = vbYes Then
'------start of iLogic-------
oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension
oRevNum = iProperties.Value("Project", "Revision Number")
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
If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
oOptions.Value("Custom_Begin_Sheet") = 1
oOptions.Value("Custom_End_Sheet") = 10
End If
'get PDF target folder path
oFolder = Left(oPath, InStrRev(oPath, "G:\Dokumentation\Ritningar\Ritningar Monitor\$Ritningar From CAD")) &"G:\Dokumentation\Ritningar\Ritningar Monitor\$Ritningar From CAD"
'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
If iProperties.Value("Project", "Revision Number") >= "1" Then
'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oFileName & _
"-" & oRevNum & ".pdf"
Else
'Set the destination file name
oDataMedium.FileName = oFolder & "\" & oFileName & ".pdf"
End If
Else
Return
End If
On Error Goto handlePDFLock
'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
'--------------------------------------------------------------------------------------------------------------------
Exit Sub
handlePDFLock:MessageBox.Show("PDF not created, most likely someone else has it open.", "No PDF for you " &ThisApplication.GeneralOptions.UserName & "!")
Resume Next
'Show message box
MessageBox.Show("Drawing saved and PDF Exported to LAST EDITED document folder/PDF", "Save I-logic")
'------end of iLogic-------