0 Replies Latest reply on Dec 22, 2011 1:13 PM by Fred Lillywhite

    Copy SW properties to pdf properties

    Fred Lillywhite

      I have an issue that would really save us some time. I am using a macro to print solidworks drawings to pdf and add the revision number. ie: drawing TEST_122211.slddrw would print as TEST_122211-R0.pdf. What I would like now is to have custom properties in SW become properties in the PDF file properties. For example, the person who creates the drawing in SW adds their name to the DRAWN custom property and uses the macro to pdf print the file. When I open the pdf in adobe and go to File>Properties in the description tab it has text boxes for Title, Author, Subject, and Keywords. I'd like to have the Author text be pulled from the DRAWN custom property in Solidworks and other properties in the title and subject fields. Instead it pulls the computer name and calls that the author. We then open the drawing up in Adobe Pro and manually edit the file properties to be what we want. Not everyone who has solidworks has adobe pro so these files have to be transferred to the person with the adobe pro license. I'm attaching some sample screenshots of what I'm looking for.




      My macro is a modification of one from duncan.gillis:


      ' C:\Temp\swx4004\Macro1.swb - macro recorded on 08/26/09 by duncan.gillis

      ' ******************************************************************************

      Dim swApp As Object


      Dim Part As Object

      Dim boolstatus As Boolean

      Dim longstatus As Long, longwarnings As Long

      Dim Revision As String

      Dim Proptype As String


      Sub main()


      Set swApp = Application.SldWorks


      Set Part = swApp.ActiveDoc


      Path = Part.GetPathName


      'check if document is open

      If Part Is Nothing Then

              MsgBox "No current document", vbCritical


          End If

      'check if document is a drawing

      If Part.GetType <> swDocDRAWING Then

              MsgBox "This Macro only works on Drawings", vbCritical


          End If


      Revision = Part.GetCustomInfoValue("", "Revision")


      If Revision = "" Then

              Revision = "DRAFT"

          End If


      PDFpath = Left(Path, Len(Path) - 7) & "-R" & Revision & ".PDF"


      longstatus = Part.SaveAs3(PDFpath, 0, 0)


      End Sub