1 Reply Latest reply on Mar 1, 2018 8:45 AM by Erhard Wuertz

    Edrawing API Print to PDF

    James Smith

      Hi Guys,

      I am new here and trying to print the drawing to pdf using edrawing control i can get the drawing to open but the printing part i am not having much luck with.

      Here is the code i am using. If anyone of you done anything similar please share with me what i am doing wrong.

       

      using System.Text;

      using System.Runtime.InteropServices;

      using System.Text.RegularExpressions;

      using System.Configuration;

      using System.Windows.Forms;

      using System.Collections.Generic;

      using System.Threading.Tasks;

      using eDrawingHostControl;

      namespace WindowsFormsApplication1

       

      {

          public partial class Form1 : Form

          {

              eDrawingHostControl.eDrawingControl ctrl = null;

              public Form1()

              {

                  InitializeComponent();

                  if (null == ctrl)

                  {

                      ctrl = new eDrawingControl();

                  }

                  this.Controls.Add(ctrl);

              }

              private void Form1_Load(object sender, System.EventArgs e)

              {

              }

              private void button1_Click(object sender, System.EventArgs e)

              {

                  if (ctrl != null)

                  {

                      ctrl.Location = new Point(0, 0);

                      ctrl.Size = new System.Drawing.Size(this.Size.Width, this.Size.Height);

       

       

                      ctrl.eDrawingControlWrapper.OpenDoc("c:\\107010.slddrw", false, false, true, "");

       

       

                

       

       

                     // ctrl.eDrawingControlWrapper.Print5(true, _T("test"), false, false, true, EModelView.EMVPrintType.eScaleToFit, 0, 0, 0, true, 0, 0, _T(""));

      //instance.Print5(ShowDialog, FileNameInPrintQueue, Shaded, DraftQuality, Color, printType, scale, centerOffsetX, centerOffsetY, printAll, pageFirst, pageLast, PrintToFileName)

                  

                     

                  }

              }

       

       

              private void button2_Click(object sender, EventArgs e)

              {

                  ctrl.eDrawingControlWrapper.Print4(false, "c:\\107010.slddrw", false, true, true, EModelView.EMVPrintType.eScaleToFit, 0, 0, 0, true, 0, 0);

              }

       

       

             

          }

      }

      Thanks

      James

        • Re: Edrawing API Print to PDF
          Erhard Wuertz

          Hi James,

           

          try this. Install a PDF-Printer (like PDF24 Creator, ...).

           

          emvControl.SetPageSetupOptions(EMVPrintOrientation.eLandscape, (int)PaperKind.A4, 0, 0, 1, 0, Printer, 0, 0, 0, 0);

          Printer = name of your PDF printer.

           

          emvControl.Print5(false, "FileNameInPrintQueue", false, false, true, EMVPrintType.eScaleToFit, 1.0, 0, 0, false, 1, 1, "");

           

          Best regards

           

          Erhard