Property description to save in pdf

Hello

We use a macro to save a drawing in pdf,

Is it possible to save the description property of the drawing in a description property?

of the pdf file?

Thanks in advance

Hello

normally everything on the MEP should follow on the PDF... An image to better understand your needs could help us...

1 Like

It's more at the Windows level that you have to look at:
- Is it possible to create a property?
- If so, how to assign a value to this property.

I guess putting the description in the filename is out of the question...

1 Like

If you have a VBA macro to generate the pdf, of course it's possible. You just need to know the VBA commands that allow you to retrieve the properties you want. The god of macro Lynkoa (C. Roger) should be able to help you if he wants to :-)

2 Likes

Good evening and thank you,

We use the macro found on lynkoa here;

http://www.lynkoa.com/forum/solidworks/macro-conversion-dxf-avec-nom-dune-propriété-de-pièce

Good evening

Can you please specify your request? You want to create your pdf file with the description in the file name or put a description in the metadata of the pdf file as in the image below.

Kind regards

1 Like

Hello

To answer you, it's "put a description in the metadata of the pdf file" my question was not too precise I concede it.

Kind regards

Hello

Here is the result of my investigations:

- By VBA macro (swp): I didn't manage to do it because I only have Acrobat Reader while a priori you need an Acrobat pro license, a little reading here and here.

- By macro csproj (dll): I didn't manage to do it because VSTA doesn't allow me to add some useful references to the processing to be done.

- By independent program in C#: Just put the open source dll named "PdfSharp.dll" (see http://www.pdfsharp.net/Licensing.ashx) as a reference, then create the few lines of code to open the pdf, create the custom property and its value and then save the pdf.

String filename = "monfichier.pdf";
PdfDocument document = PdfReader.Open(filename);
document.Info.Elements.Add(new KeyValuePair<String,PdfItem>("/Description",new PdfString("Ma description")));
document.Save(filename);

 

So, yes it's doable but the solution I see is the creation of an independent program to control Solidworks in order to create the PDFs from the MEPs, to add the desired metadata in this PDF. This program could be launched directly or through an internal Solidworks macro.

It is a solution that requires some knowledge of C# programming.

People with more in-depth knowledge than me about macros in VBA may have a solution to offer you.

Kind regards

3 Likes

Hello

No better than d.Roger. I couldn't find a way without going through external dlls. The Acrobat Reader APIs do not expose members to do this.

Hello

Thank you for spending time, well I think we'll do without this "designation"

Thanks again,

See you soon

Hello

my answer may be off the mark, but there is a solution,

If you have EPDM and the My-PDM-TOOL tools you can use the DocPublication tool which manages to write meta data in PDFs

1 Like

from memory, EPDM already allows you to add properties without an add-on module it seems to me,

by going to "Task" and then one of the tabs of the task, allows you to "transpose/copy" properties,

Example: Description, Designation, etc.

This may require creating a "map" for this type of file.

If anyone ever manages to create a macro that does this:

transpose XX custom properties

and/or (at the user's choice)

transpose XX properties to the config

I would also be interested in that.