Save PDF to our Vault

Save PDF to our Vault

johan.degreef
Advisor Advisor
910 Views
16 Replies
Message 1 of 17

Save PDF to our Vault

johan.degreef
Advisor
Advisor

Dear, is it a lot of work to make this code also a PDF to a specific folder in our Vault? This one only stores a PDF to a network location. Many thanks, if you can help.

 

I know Vault have some PDF add ins, but we want to do it like here "on every save"

 

 

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(oDocument, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2'oOptions.Value("Custom_End_Sheet") = 4
End If 


'get PDF target folder path
oFolder = "\\192.168.1.1\PDF_INVENTOR\"


'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


 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oFileName & ".pdf" 


'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 
'------end of iLogic-------

 

 

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes
911 Views
16 Replies
Replies (16)
Message 2 of 17

bradeneuropeArthur
Mentor
Mentor

Hey Johan. It may be easier to attached the pdf to the Inventor file, and than check it in. Otherwise I would prefer to use the Vault API...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 17

johan.degreef
Advisor
Advisor

@bradeneuropeArthur 

How do i attach a PDF to a dwg in inventor? Not familiar with that workflow....?

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes
Message 4 of 17

bradeneuropeArthur
Mentor
Mentor

Hey Johan,

 

bradeneuropeArthur_0-1716884972398.png

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 17

johan.degreef
Advisor
Advisor

OK, If you follow this method, were does the PDF lands in our Vault structure?

Also our current code is very fast - you don't even notice there is a PDF written to our network share. Will this procedure be as fast?

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes
Message 6 of 17

bradeneuropeArthur
Mentor
Mentor

Same structure as the local path.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 17

bradeneuropeArthur
Mentor
Mentor

Hey Johan,

 

Please let me know where you would like to have stored the Pdf file in the vault related to the native file location.

For example the drawing is located in "$\vaultworkspace\projects\1234\dwg" and the pdf need to be stored for example here "$\vaultworkspace\projects\1234\Pdf"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 8 of 17

johan.degreef
Advisor
Advisor

All the PDFs are in 1 folder:

c:\$WorkingFolder\PDF\

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes
Message 9 of 17

bradeneuropeArthur
Mentor
Mentor

That seems to very simple than.

Are you happy with a add-in for Inventor doing this?

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 10 of 17

johan.degreef
Advisor
Advisor

@bradeneuropeArthur wrote:

That seems to very simple than.

Are you happy with a add-in for Inventor doing this?

 

 


You mean the code in the OP to write a PDF to a network share? yes

But it does not add it to Vault every save...

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes
Message 11 of 17

bradeneuropeArthur
Mentor
Mentor

Sure this can be done within the same add-in.

  1. Creating the pdf file
  2. attach it to the dwg
  3. add file to the Vault with the check in option from Inventor

Let me know if this is what you need and I can create it for you in the evening...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 12 of 17

johan.degreef
Advisor
Advisor

@bradeneuropeArthur wrote:

Sure this can be done within the same add-in.

  1. Creating the pdf file
  2. attach it to the dwg
  3. add file to the Vault with the check in option from Inventor

Let me know if this is what you need and I can create it for you in the evening...


  1. Creating the pdf file
  2. save it to network share
  3. attach it to the dwg
  4. add file to the Vault with the check in option from Inventor

when will it be triggered? Now we set it on every save. But what if we do not check in after a save?

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes
Message 13 of 17

youann21700
Advocate
Advocate

I had a similar issue a while back, we wanted a PDF of an "Approved and Issued" drawing to be automatically uploaded to a set folder in the Vault. I'm sure there is a way to do this with Vault Pro API, but we use Vault Basic.

Here's the thread:

Solved: Re: Upload PDF file to Vault Basic with iLogic - Autodesk Community - Inventor

 

0 Likes
Message 14 of 17

bradeneuropeArthur
Mentor
Mentor

Sure you can also use the job processor, and make a create a custom job for Vault.

Then you are more flexible when (on conditions) this job is processed!

This is the most practical way, but that is not what Johan needs.....

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 15 of 17

youann21700
Advocate
Advocate

We don't have Job processor since we only use Vault basic.

The iLogic code in the thread I linked can be edited to save the generated PDF in whatever folder you want. It then inserts the PDF as an object to the drawing file, like the add-in does, so when the drawing is checked in, the PDF will also be checked in. We just automated it so people don't mess it up or forget.

If you set up an iTrigger so run the rule whenever you save, a PDF will be created on each save, and when you check the drawing in, all PDF will also be checked in.

Message 16 of 17

johan.degreef
Advisor
Advisor

@bradeneuropeArthur wrote:

Sure you can also use the job processor, and make a create a custom job for Vault.

Then you are more flexible when (on conditions) this job is processed!

This is the most practical way, but that is not what Johan needs.....


If this also works on every check in, this is also an option

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes
Message 17 of 17

m_baczewski
Advocate
Advocate

Hello @johan.degreef 

 

here is the code that adds a PDF to the Vault while creating the PDF. I'm not sure if this is what you were looking for. If you need any further assistance, feel free to ask, and I'll try to help. In the code I provided, I use a library written by Markus Koechl. Additionally, I'm including a link to the GitHub repository where it explains how to add this library and use it in iLogic rules.

 

https://github.com/koechlm/iLogic-Vault (everything about QuickstartiLogicLibrary.dll)

AddReference "QuickstartiLogicLibrary.dll" <--- header

'enable iLogicVault commands and validate user's login state
Dim iLogicVault As New QuickstartiLogicLibrary.QuickstartiLogicLib
If iLogicVault.LoggedIn = False
Logger.Error("Not Logged In to Vault! - Login first and repeat executing this rule.")
Exit Sub
End If

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(oDocument, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2'oOptions.Value("Custom_End_Sheet") = 4
End If 


'get PDF target folder path
oFolder = "\\192.168.1.1\PDF_INVENTOR\"

'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

 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oFileName & ".pdf" 

'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 

'upload file as new or incremental file iteration and attach to thisdoc in Vault
Dim mVaultPath As String = iLogicVault.ConvertLocalPathToVaultPath(oDataMedium.FileName)
Dim mParentVaultFullFileName = iLogicVault.ConvertLocalPathToVaultPath(ThisDoc.Document.FullFileName) + "/" + ThisDoc.FileName(True)

success = iLogicVault.AddFile(oDataMedium.FileName, mVaultPath, True, mParentVaultFullFileName)
If (success <> True)Then
Logger.Error("Failed to add/update file to Vault")
Else
Logger.Info("Successfully created .PDF.")
End If
'------end of iLogic-------

 

 

0 Likes