18 Replies Latest reply on Jan 24, 2011 6:32 AM by Simon Schuck

    Automatic PDF Creation without SW

    Ajay Baranwal

      Hi Everyone,

       

      Is their any procedure to generate automatic PDF from word doc or excel sheets without using Solidworks by applying the codes on the EPDM transition???

       

      If yes then please tell me how to do this.

      Please spend some valuable time of yours...................

       

      Thanks

      Ajay

        • Re: Automatic PDF Creation without SW
          Ajay Baranwal
          any suggestions..............
            • Re: Automatic PDF Creation without SW
              Chris Sonon

              Create a macro in word/excel (or a script/program) that will create a PDF of those two file types and call that program as part of a workflow. For more information on macro's for word/excel do a google search.

               

              God Bless,

              Chris

              • Re: Automatic PDF Creation without SW
                Michael Petersheim

                Here is some code to get you started with an API add-in. I used MS Word API and an open source PDF printer named "PDFCreator". So far I have used this only for testing, and have not created an add-in yet.

                 

                Dim PDFCreator1 As New clsPDFCreator
                Dim pErr As New clsPDFCreatorError
                With PDFCreator1
                    .cVisible = True
                    If .cStart("/NoProcessingAtStartup") = False Then
                        If .cStart("/NoProcessingAtStartup", True) = False Then
                            Exit Sub
                        End If
                        MsgBox("Use an existing running instance!")
                        .cVisible = True
                    End If
                    opt = .cOptions
                    .cClearCache()
                    noStart = False
                End With

                Dim appWord As Word.Application
                Dim wrdDoc As Document
                ' Create new instance of word application.
                appWord = New Word.Application
                ' Save currently active printer.
                Dim defaultPrinter As String = PDFCreator1.cDefaultPrinter
                ' Set pdf creator as active printer. Name should be same as you gave while installation.
                appWord.ActivePrinter = "PDFCreator"
                wrdDoc = appWord.Documents.Open(path)
                wrdDoc.PrintOut(True, True, WdPrintOutRange.wdPrintAllDocument, , , , _
                                WdPrintOutItem.wdPrintDocumentContent, _
                                1, , WdPrintOutPages.wdPrintAllPages, False)
                With opt
                    .AutosaveDirectory = Strings.Left(path, Strings.InStrRev(path, "\"))
                    .AutosaveFilename = "test"
                    .UseAutosave = 1
                    .UseAutosaveDirectory = 1
                    .AutosaveFormat = 0 ' PDF
                End With
                PDFCreator1.cOptions = opt
                'Wait till doc gets queued up.
                While PDFCreator1.cCountOfPrintjobs <> 1
                End While
                ' Tell PDFCreator to combine all the documents.
                'PDFCreator1.cCombineAll()
                ' Start the printer.
                PDFCreator1.cPrinterStop = False
                wrdDoc.Close(False)
                appWord.ActivePrinter = defaultPrinter
                appWord.NormalTemplate.Saved = True
                appWord.Quit()
                wrdDoc = Nothing
                appWord = Nothing

                If noStart = False Then
                    PDFCreator1.cClose()
                End If
                PDFCreator1 = Nothing
                pErr = Nothing
                opt = Nothing

              • Re: Automatic PDF Creation without SW
                Simon Schuck

                Hi All....

                 

                Has anyone got any further with this? As I am trying to implement a method of capturing PDF's within EDPM which arent solidworks doc's. I am still learning so a bit of a pointer push would be great - thanks!

                • Re: Automatic PDF Creation without SW
                  Simon Schuck

                  Sorry.... What I want to do is be able to create a task so a user can right click on a document and print to pdf which we currently can do for Solidworks documents but not for anything else. If we print with another 3rd party application such as  "PdfCreator" it tries to save the printed pdf document to the users profile as apposed to the PDM folder where the project/original file is located.

                   

                  Thanks

                  • Re: Automatic PDF Creation without SW
                    Simon Schuck

                    Would you be able to point me in the direction of any guides. Ive been trying to find some pointers but havent had much luck. Am I right in thinking by creating the executable within Studio Works express I could import that into EPDM?

                     

                    Thanks

                    • Re: Automatic PDF Creation without SW
                      Simon Schuck

                      My programming skills are limited, I can do a little vbs. Ive nipped over to that site and signed up - hopefully it will shed a little light on the subject. Searching this and other sites its reccomended that I copy the solidworks task already created and then apply the addin to that in order to achieve the PDF creation - confused???

                       

                      Have you had a go at creating an addin for any perticular tasks? If so what steps would you reccomend I take considering this is all very new to me...

                       

                      Thanks

                        • Re: Automatic PDF Creation without SW
                          Jesse Seger

                          One thing to keep in mind is I beleive you will need Visual Sutdio Professional, not express.  This allows your add-in to be com-visible.  Your class must implement the IEpdm5 interface also.

                           

                          A EPDM Task is how you Execute the Add-in.  The existing Add-in in EPDM allows you to run VB to perfrom SW stuff.  I'm not sure about the limit of stuff you could actually put in there.

                           

                          I'm fairly new to EPDM.

                            • Re: Automatic PDF Creation without SW
                              Jim Sculley

                              Jesse Seger wrote:

                               

                              One thing to keep in mind is I beleive you will need Visual Sutdio Professional, not express.  This allows your add-in to be com-visible.  Your class must implement the IEpdm5 interface also.

                               

                              A EPDM Task is how you Execute the Add-in.  The existing Add-in in EPDM allows you to run VB to perfrom SW stuff.  I'm not sure about the limit of stuff you could actually put in there.

                               

                              I'm fairly new to EPDM.

                              VS Express works fine.  I have made several EPDM addins using Visual C# Express.

                          • Re: Automatic PDF Creation without SW
                            Pat O'Brien

                            Google Bullzip PDF Printer. I downloaded the free PDF Printer. It turns what ever I am looking at on the screen into a PDF. I use it all the time, with AutoBad or even if I am looking at a page on the Internet.

                            • Re: Automatic PDF Creation without SW
                              Tor Iveroth

                              Ajay,

                              an alternative to creating a custom task add-in could be to trigger the PDF creation via Enterprise Dispatch.  There is an example of this on the Enterprise PDM install image under ..\Support\Dispatch\Dispatch Examples

                               

                              -Tor Iveroth, SolidWorks tech support

                              • Re: Automatic PDF Creation without SW
                                Simon Schuck

                                Great so there are methods to achive this.... I dont suppose someone could elaborate on these methods please? I've looked into creating a custom task  but it still seems to "want" a solidworks addin.

                                 

                                Just to get my head around this - how do I acieve creating something to convert the file to a pdf. Do I apply a convert/print to pdf vbs script to a task which then opens the file in the background converts/prints to pdf and then saves it in the relative/desination folder?

                                 

                                Thanks...