Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a very large rule that is fully functioning. It does several updates to the drawing that is open and then creates a PDF of the drawing in a new directory. I have taken copied a small piece from the rule (below). I would like to add additional functionality to it.
Currently the user can choose to override the existing PDF or to cancel the operation. I would like to add a third option that will move the existing PDF to a sub-folder and add a prefix to the archived PDF and create the new PDF as it already does.
The old PDF should look something like this:
oPath & "\00 Archive\" & "OLD " & oFileName & ".pdf"
Segment of currently functioning rule:
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 1200
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintCurrentSheet
oFolder = Left(oPath, InStrRev(oPath, "\")) 'get PDF target folder path
oDataMedium.FileName = oPath & "\" & oFileName & ".pdf" 'Set the PDF target file name
'Check if PDF already exists
If System.IO.File.Exists(oDataMedium.FileName) Then
Logger.Info("The PDF already exists.")
Answer = MessageBox.Show("PDF ALready Exists. Override?", "WARNING", MessageBoxButtons.YesNo)
If Answer = vbNo Then
Logger.Info("Canceling Proceedure because user did not want to override existing PDF")
Return
Else
Logger.Info("User chose to override existing PDF")
End If
End If
Try
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 'Publish document
Catch ex As Exception
Logger.Info("Failed to Create PDF. Existing PDF may already be in use.")
Return
End Try
Solved! Go to Solution.