Direct Print/Cut Paper Epson Printer

Posted by: ricgom731 on 29 May 2020, 9:28 am EST

    • Post Options:
    • Link

    Posted 29 May 2020, 9:28 am EST - Updated 30 September 2022, 5:11 pm EST

    Good morning

    I have an MVC Web application in Active Reports 11 and I am printing using a Web Viewer / AcrobatReader. This print is generated on a printer

    Epson tm-t20ii. To this Epson printer I configure the page cut in the printer’s own options and it works very well.

    But if I use the following instruction …

    PrintExtension.Print (rpt.Document, false, false);

    This way it prints directly without preview. But the problem is that automatic cutting is not done when using this last instruction. despite having the cut configured in the printer options?

    Why if it is sent directly without preview does the printer not cut? How can I do the automatic cut using the PrintExtension.Print command (rpt.Document, false, false);

    Thank you

  • Posted 29 May 2020, 11:40 am EST

    I forgot to mention the following…

    If you use this statement in your Visual Studio development environment, the document prints and does the automatic cut, but if you print from a production environment on an IIS server, print the document but it does not do the automatic cut.

  • Posted 1 June 2020, 3:14 am EST - Updated 30 September 2022, 5:11 pm EST

    Hello,

    Can you please try after setting the Built-in Account to LocalSytem as shown in the attached image.

    Thanks,

    Mohit

  • Posted 1 June 2020, 12:53 pm EST

    I did what it tells me, but it does not make the utomatic cut in production.

    Is there any other possible request?

    From C # or Active Reports is it possible to send an instruction or escape statement to make the automatic cut on each page?

  • Posted 1 June 2020, 1:19 pm EST

    Hello,

    is it possible to send an instruction or escape statement to make the automatic cut on each page?

    Yes, Please refer the following link:

    http://help.grapecity.com/activereports/webhelp/AR11/webframe.html#GrapeCity.ActiveReports.v11~GrapeCity.ActiveReports.SystemPrinter~Escape.html

    Thanks,

    Mohit

  • Posted 1 June 2020, 3:23 pm EST

    what is m_myARPrinter?

  • Posted 2 June 2020, 10:56 am EST - Updated 30 September 2022, 5:11 pm EST

    Doubts …

    1. Escape (“& 1 OH”); Does this escape code refer to the page break?
    2. The instruction does not recognize me …

      DataDynamics.ActiveReports.Interop.SystemPrinter m_myARPrinter = new DataDynamics.ActiveReports.Interop.SystemPrinter ();

    using GrapeCity.ActiveReports;

    using DataDynamics.ActiveReports;

    But even so the instruction does not recognize me.

    It is not very clear to me how to apply the code, could you please help me to apply it in my code?

    MyReport rpt = new MyReport(List_xyz);

    rpt.DataSource = Listxyz;

    rpt.Document.PrintOptions.PageScaling = GrapeCity.ActiveReports.Extensibility.Printing.PageScaling.FitToPrintableArea;

    rpt.Run();

    PrintExtension.Print(rpt.Document, false, false);

    return Json(true, JsonRequestBehavior.AllowGet);

    How do I tell ActiveReport that I want to make the Espon TM-20ii printer make a cut after each page?

    In my code I am sending direct printing without using a WebViewer.

    aPage = viewer1.Document.Pages [i];

  • Posted 2 June 2020, 2:03 pm EST

    Hello,

    1. Escape (“& 1 OH”); Does this escape code refer to the page break?

      This is just a sample code. In my understanding, different printers have different escape codes.
    1. The instruction does not recognize me …

      DataDynamics.ActiveReports.Interop.SystemPrinter m_myARPrinter = new DataDynamics.ActiveReports.Interop.SystemPrinter ();

    Are you using which version of AR? This seems to AR6 or earlier version. Please use in the last version that you have.

    Also, its comes under the GrapeCity.ActiveReports namespace as follow:

    GrapeCity.ActiveReports.SystemPrinter

    It is not very clear to me how to apply the code, could you please help me to apply it in my code?

    You need access each document page after Run command as follow:

    {
        foreach (GrapeCity.ActiveReports.Document.Section.Page opage in orptReOrderInvoice.Document.Pages)
        {
            pageWidth = opage.Width - 0.2;
            pageHeight = opage.Height - 0.2;
    
            GrapeCity.ActiveReports.SystemPrinter sp = new GrapeCity.ActiveReports.SystemPrinter();
            // sp.PrinterSettings.DefaultPageSettings.PaperSource = sp.PrinterSettings.PaperSources(My.Settings.TrayNo)
            StringBuilder PJL = new StringBuilder(ESC + "%-12345X" + Constants.vbCrLf);
    
            sp.StartJob("Print White Copy Invoice");
            PJL.Append("@PJL JOB MODE=PRINTER" + Constants.vbCrLf);
            PJL.Append("@PJL SET FINISH=ON" + Constants.vbCrLf);
            PJL.Append("@PJL SET STAPLE=TOPLEFT " + Constants.vbCrLf);
            PJL.Append(ESC + "%-12345X" + ESC + Constants.vbCrLf);
            PJL.Append(ESC + "&l1H");
    
            sp.Escape(PJL.ToString());
            sp.StartPage();
            sp.PaperSize = sp.PaperSizes(0);
            rcPage.Width = pageWidth;
            rcPage.Height = opage.Height;
    
            sp.EndPage();
                            sp.EndJob();
        }
    }
    

    Hope it helps.

    Thanks,

    Mohit

  • Posted 2 June 2020, 2:27 pm EST - Updated 30 September 2022, 5:11 pm EST

  • Posted 2 June 2020, 2:38 pm EST

    Thanks but …

    What is it

    “Constants.vbCrLf”

    Is “\r\n” in c#?

    Where is it declared? I need a use.

  • Posted 3 June 2020, 7:20 am EST

    Hello,

    Is “\r\n” in c#?

    Yes. It just some conversion error. Sorry for the confusion.

       sp.PaperSize = sp.PaperSizes(0);
    

    Can you please try after removing the above line.

    Thanks,

    Mohit.

  • Posted 3 June 2020, 10:19 am EST - Updated 30 September 2022, 5:11 pm EST

  • Posted 3 June 2020, 10:24 am EST

    Sorry for so much question, but I can’t get the printer to make the cut.

    I have doubts…

    What are all these characters?

    I don’t know if my code should include all these characters?

    PJL.Append(“@PJL JOB MODE=PRINTER” + Constants.vbCrLf);

    PJL.Append(“@PJL SET FINISH=ON” + Constants.vbCrLf);

    PJL.Append("@PJL SET STAPLE=TOPLEFT " + Constants.vbCrLf);

    PJL.Append(ESC + “%-12345X” + ESC + Constants.vbCrLf);

    PJL.Append(ESC + “&l1H”);


    In which variable is the escape| code of my Epson printer assigned?

    ESC = Escape Code TM-20ii?

    In the manuals of this printer model I found the following (See attached image).

    But my question is how to tell ActiveRepots that this is my escape code to cut every page.

    Link Epson page…

    https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=72

    I tried like this … (I don’t know if it’s correct) but it doesn’t work.

    string ESC = Convert.ToString((char)27 + “i”);


    And how to make specifically my report of my code make the cut …

    MyReport rpt = new MyReport(List_xyz);

    rpt.DataSource = Listxyz;

    rpt.Document.PrintOptions.PageScaling = GrapeCity.ActiveReports.Extensibility.Printing.PageScaling.FitToPrintableArea;

    rpt.Run();

    PrintExtension.Print(rpt.Document, false, false);

  • Posted 5 June 2020, 3:43 pm EST

    Hello,

    I just provide you the sample code to show how to use the escape code. You can contact your Espon Customer support to know the exact escape command and after that you can use the same escape command in our code.

    I am very sorry that I am not so helpful in this case.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels