Export drawing as PDF with Revision custom properties in data card

Hey all,

I’m working on a tool to pull custom property information from PDF’s via the PDM REST API. I have set up my part and drawing templates to do what I would like, but I am having issues with the “Save As” PDF function which does NOT drop in the latest Revision into the data card.

Our current workflow when finishing a part drawing is to save the drawing as a PDF with the a schema of:
“partNum (REV X).pdf”

Moving forward, I want to add that RevisionNum into the data card, and go back to all existing drawings to do the same via macro/automation.

I’d rather not use a macro for PDF creation on new parts as it seems that this type of information should be pulled in automatically from the revision table, but maybe I’m not setting my variables up correctly for the data card. Does anyone have any experience with this?

Below is a screenshot of my variable setup in PDM.

I should mention that the “Convert SLDDRW to PDF” function via PDM does work as I’d like, but it is an extremely slow process that we will need to do for some 5000+ parts, so any suggestions in that arena are also appreciated.

Thanks!

So you’re trying to save a PDF of a drawing and in the process add the revision to the data card of the PDF? Do you want a solution that scales because this process is extremely slow since you have thousands of files to process?

Are the assumptions above correct?

Hey @AmenJlili , Yes, your assumptions are correct. Once the Revision data is figured out, I may find it useful to add in other property data like ECO number, Finish, Material, etc.

But Revision is the most important data field that I need, so having just that would be enough.

I would need to do this moving forward for any new parts created, and retroactively for any existing parts.

I mean without understanding how you are doing this code-wise, there isn’t much I can help you with.

For adding the rev to the PDF, you need to check the file out, add the rev and check it back into the vault.

I’m assuming you’re using the PDM Web API to develop a third-party web app so your optional are limited. You might be able to initiate an task that does from the Web API and constantly call your web API endpoints until you get your data. Implement a timeout for safety.

I’m not too sure if the PDM Web API implements a call for launching tasks. You need to double check that…

@AmenJlili

I apologize, I think I’ve caused some confusion, we are working with SolidWorks 2021 and SolidWorks PDM, the PDM Web API is not a limiting factor here.

My thought is that there might be a method to add the metadata to the PDF export via the SolidWorks API. This is really the main point I’m seeking advice for.

To retroactively add in the metadata to existing PDF’s in the vault, I may be able to leverage the built-in task scheduler for PDM to convert SLDDRW to PDF and overwrite said PDF’s, but I was hoping there way another way to accomplish the task. This is a secondary concern.

Do you know of any methods to implement a macro that could export to PDF with metadata?