No announcement yet.

Scripting "print to pdf" Can anyone help please?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Scripting "print to pdf" Can anyone help please?

    Hi All,

    Currently trying to create a script to print to PDF and not really getting anywhere. I have installed PDFCreator and it has some custom scripts but none of which I can get to work.

    What would be the best method of achieving this?

    Thanks loads!!

    A distressed Shabba!

  • #2
    Re: Scripting "print to pdf" Can anyone help please?

    Hello, I have used redmon and ghostscript to create pdf files before.

    Although I am not really sure what you mean by scripting the printjobs.

    MCITP sa, ea & va, [email protected]


    • #3
      Re: Scripting "print to pdf" Can anyone help please?

      Thanks for that - and sorry I should try and make myself a little clearer. What I am trying to achieve is to automate a print job which ties into Solidworks PDM. Currently the user can create a PDF from any solidworks document by initiating a task. I would like to achive this for any other document which isnt a solidworks document.

      In order to achieve this I need to create a vb script which does the printing and then tie it in to Solidworks PDM which then pushes the job to the pdf printer and saves it in the relevant folder....



      • #4
        Re: Scripting "print to pdf" Can anyone help please?

        In our office, we convert all our print jobs into a PDF file. The application we use is UniPrint. Any application that has a printing function, UniPrint can convert that job into a PDF file.


        • #5
          Re: Scripting "print to pdf" Can anyone help please?

          I use CutePDF Writer (free). After the simple install (which installs ghostscript after the program), you will see CutePDF Writer listed as a printer. Print to it, and it'll let you name and save a PDF anywhere on your PC.

          Not familiar with Solidworks PDM, but if I'm understanding you correctly, you want to call a script and based on unknown parameters have it convert docs to PDFs and then insert them into the Solidworks system?
          ** Remember to give credit where credit is due and leave reputation points where appropriate **


          • #6
            Re: Scripting "print to pdf" Can anyone help please?

            Thanks for the replies..... But its not really what I am trying to achieve. I know of the prog's that convert to PDF's but what Im trying to achieve is a little different.

            Within Enterprise PDM there is a script which uses the print funtion within Solidworks which converts drawings to PDF's. What I am trying to do (currently with PDFCreator) is script a task so it calls up the pdf printer as per example below:

            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
                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.
            ' Start the printer.
            PDFCreator1.cPrinterStop = False
            appWord.ActivePrinter = defaultPrinter
            appWord.NormalTemplate.Saved = True
            wrdDoc = Nothing
            appWord = Nothing
            If noStart = False Then
            End If
            PDFCreator1 = Nothing
            pErr = Nothing
            opt = Nothing
            Last edited by Rems; 26th January 2011, 15:35.