Solved! heres a link to the solution, https://forums.autodesk.com/t5/inventor-programming-ilogic/upload-pdf-file-to-vault-basic-with-ilogi...
heres the code as well:
'CODE BY EUAN YOUR WELCOME
'THIS STARTS A TRANSACTION, WHATEVER THAT IS, THEY CAN TRACK CHANGES TO A DOCUMENT, THEREFORE CAN BE REVERSED
Sub Main()
Dim trans As Transaction = ThisApplication.TransactionManager.StartTransaction(ThisApplication.ActiveDocument, "Export and Attach PDF file")
Try
If Not ThisApplication.ActiveDocument.FullFilename = String.Empty Then 'won't run if the active document isn't saved.
Dim filenameToAttach As String = ExportToPDF()
If Not filenameToAttach = String.Empty Then
Dim doc As Document = ThisApplication.ActiveDocument
AddReferences(doc, filenameToAttach)
End If
Else
MessageBox.Show("File not saved; save the file and try again!")
trans.Abort()
End If
trans.End()
Catch
trans.Abort()
End Try
End Sub
'MAIN FUNCTION, EXPORTS A PDF FILE OF THE DRAWING, REMOVES LINE WEIGHTS, MAKES READ ONLY (ITS AN ISSUED DRAWING SO READ ONLY IS NEEDED)
Function ExportToPDF() As String
Dim filename As String
' Get the PDF translator Add-In, that is the long string, others for other file formats are online somewhere.
Dim oPDFTranslator As TranslatorAddIn
oPDFTranslator = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
If oPDFTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Sheet_Range") = kPrintAllSheets
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim oData As DataMedium
oData = ThisApplication.TransientObjects.CreateDataMedium
oData.FileName = ThisDoc.Path & "\Issued\" & ThisDoc.FileName(False) & " REV " & iProperties.Value("Project", "Revision Number") & " " & iProperties.Value("Custom", "ReleaseStatus") & " .pdf"
checkpath = ThisDoc.Path & "\Issued"
Dim oFolder As String = checkpath
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
oPDFTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData)
filename = oData.FileName
Dim oFile As System.IO.FileInfo
oFile = New System.IO.FileInfo(filename)
oFile.IsReadOnly = True
End If
If System.IO.File.Exists(filename) Then
Return filename
Else
Return ""
End If
End Function
'THIS PART MAKES THE PDF A REFERENCED DOCUMENT IN THE DRAWING, MEANS WILL BE CHECKED IN/OUT WITH THE DRAWING, this solves the issue of that initial check-in
Public Sub AddReferences(ByVal odoc As Inventor.Document, ByVal selectedfile As String)
Dim oleReference As ReferencedOLEFileDescriptor
If selectedfile.Contains("|") Then ' we have multiple files selected.
Dim file As String() = selectedfile.Split("|")
For Each s As String In file
oleReference = odoc.ReferencedOLEFileDescriptors _
.Add(s, OLEDocumentTypeEnum.kOLEDocumentLinkObject)
oleReference.BrowserVisible = True
oleReference.Visible = False
oleReference.DisplayName = Mid$(s, InStrRev(s, "\") + 1)
Next
Else
oleReference = odoc.ReferencedOLEFileDescriptors _
.Add(selectedfile,OLEDocumentTypeEnum.kOLEDocumentLinkObject)
oleReference.BrowserVisible = True
oleReference.Visible = False
oleReference.DisplayName = Mid$(selectedfile, InStrRev(selectedfile, "\") + 1)
End If
End Sub