AnsweredAssumed Answered

EDrawing API automatically print to default printer

Question asked by Robert Duncan on Jan 12, 2016
Latest reply on Feb 17, 2018 by James Smith

I'm trying to write a function to automatically print a loaded into the EDrawing control in a Windows Form application to the user's default printer. The user should not have to see a printer dialog.


I'm using Visual Studio 2012 and E-Drawing 2016.


This is the code I'm using, which I inserted into a new project based on one of the examples on the API help site.


If I make the first option of Print5 true to show the Printer Dialog, I do see the print dialog and can print the drawing. It does display the right printer if I change the default.


If this option is false, the code goes to the OnFailedPrint event handler.


Am I missing something here?




        private void printDrawing(string FileName)
                PrinterSettings ps = new PrinterSettings();
                string pName = ps.PrinterName;  //Get Default Printer Name
                    1, 0, 0, 1, 7, pName, 0, 0, 0, 0);

                eDrawingControl1.eDrawingControlWrapper.OnFinishedPrintingDocument += drawing_Printed;
                eDrawingControl1.eDrawingControlWrapper.OnFailedPrintingDocument += drawing_PrintFailed;
                eDrawingControl1.eDrawingControlWrapper.Print5(false, FileName, false, false, false,
                    EModelView.EMVPrintType.eScaleToFit, 0, 0, 0, false, 0, 0, "");
                MessageBox.Show("Printed: " + FileName);
            catch (Exception ex)

        private void drawing_Printed(string JobName)
            MessageBox.Show("Printed: " + JobName);
        private void drawing_PrintFailed(string JobName)
            MessageBox.Show("Not Printed: " + JobName);