7 Replies Latest reply on May 19, 2014 4:06 PM by Doug Foote

    eDrawings - Print to pdf from a VB6 project

    Filippo Imperatore

      Hi, I hope to be in the right section.

       

      I Should create a project in VB6 for a client of mine.

      The customer selects a SLDDRW file and my program should print the file with PDFCreator (to obtain the PDF version), using eDrawings.

       

      I I thought to do this simply by using CreateObject, but I do not know what to write as a class: I know that with Word I have to write CreateObject ("Word.Application"), but for eDrawings I do not know how to do.

       

      At this point I have to change the printer in eDrawings selecting PDFCreator and then start printing.

       

      Can anyone help me?

       

      Thanks

        • Re: eDrawings - Print to pdf from a VB6 project
          Simon Turner

          You cannot use CreateObject - you have to use the eDrawings ActiveX control by adding the EmodelView.dll component to your project (Project -> Components -> Browse)

          Then add that component to a Form.

          Now you can use that control to open a file and print it.

          Note that it is multi-threaded, so when opening a file, you need to wait for the OnFinishedLoadingDocument event.

          When printing, wait for the OnFinishedPrintingDocument event.

            • Re: eDrawings - Print to pdf from a VB6 project
              Filippo Imperatore

              Thank you for your response.

               

              I tried to do as suggested, but I have a problem.

               

              On a form I have inserted the control EModelViewControl and then I wrote the following code

               

              Private Sub Command1_Click()

                  Call EModelViewControl1.OpenDoc("C:\Prova.SLDDRW", False, False, True, "")

              End Sub

               

              Private Sub EModelViewControl1_OnFinishedLoadingDocument(ByVal FileName As String)

                  'Debug.Print "Load Terminato"

                   ???????    THIS IS THE PROBLEM!!!!!!

              End Sub

               

              Private Sub EModelViewControl1_OnFinishedPrintingDocument(ByVal PrintJobName As String)

                  Call EModelViewControl1.CloseActiveDoc("")

              End Sub

               

               

              What I can not do is tell the control which printer to use and what command to use to print (I think PRINT2).

               

              Since one of the parameters of PRINT2 is filename, I must open the file before or do not need?

               

               

              Thanks for the help

               

               

              P.S: sorry for my bad english

            • Re: eDrawings - Print to pdf from a VB6 project
              Doug Foote

              Has there been success in having the onFinishedPrintingDocument fire when needed?  I have a similar app I have  been using and the events never fired so I run them in sequence with a Sleep inbetween.

              Sometimes the sleep is not enough.

              Would be great if I could get the events to fire.

               

              Thanks for any information you can give