Thermal Printer roll paper height

Posted by: info on 16 June 2020, 11:09 am EST

    • Post Options:
    • Link

    Posted 16 June 2020, 11:09 am EST

    442/5000

    Hi,

    I’m having so many problems using flexReport when printing reports on an Epson Tm80 printer, problems never had using the now obsolete c1report.

    In practice, the report that I have to print has a different length. It can be 10 inches rather than 100 inches.

    By setting the page size as follows:

    
    	report.PageSettings.Height = 12000 twips;
    		
    	int pageHeight = (int)(report.PageSettings.Height.Convert(UnitTypeEnum.Inch) * 100);
        int pageWidth = (int)(report.PageSettings.Width.Convert(UnitTypeEnum.Inch) * 100);
        settings.DefaultPageSettings.PaperSize = new PaperSize(report.PageSettings.PaperSize.ToString(),                                                                          
     pageWidth, pageHeight);
        report.Print(settings);
    
    

    takes the default height specified in the windows settings.

    How can I solve it?

  • Posted 16 June 2020, 11:18 am EST

    more than analyzing the posted code, can you show me the most correct way to print a flexreport document, without using the flexViewer, on a non-predefined printer, with the paper format and orientation simply contained in the report? Thanks, Marco

  • Posted 16 June 2020, 1:03 pm EST

    I created a test project that replicates the anomaly.

    In the example shown, the print it does is much shorter than it should be.

    Is it a bug or am I wrong?

    Regards

    ExampleBugFlexReport.zip

  • Posted 17 June 2020, 3:24 am EST

    Hi,

    I cannot test it using your real printer. But by using “PDFCreator”, it seems to work, see attached pdf file. Or is there something broken that I don’t see?

    Best regards

    Wolfgang

  • Posted 17 June 2020, 3:42 am EST

    Good morning,

    exactly … exporting to pdf works.

    The problem is related to real printing on any 80mm printer.

    This type of printer is widely used in the development of applications for restaurants, hotels and assistance.

    Can you find a hardware printer and find a solution / fix?

    Otherwise I would have to find an alternative way for this section as I have clients who are working very badly.

    Thanks, regards, Marco

  • Posted 17 June 2020, 3:59 am EST

    Hi Marco,

    I am not from C1, and I don’t have access to this kind of printer, sorry. So I cannot provide further help.

    Some things that come in my mind:

    -Could you try to set a smaller page width?

    -Did you see this Stackoverflow post? https://stackoverflow.com/questions/4365360/printing-on-roll-paper

    Maybe it helps if you give your papersize a “real” name instead of “custom” (which happens in this line: “flexReport.PageSettings.PaperSize.ToString()”.

    Just for the records: my previous reply did not contain the PDF output, so I attach it here.

    Best regards

    Wolfgang

    rptPosChiusuraTurno80.zip

  • Posted 17 June 2020, 5:36 am EST

    Hi Wolfgang,

    sorry, I understood you were from C1.

    Thanks for the tips.

    However I think I solved it using flexreport, using the following code:

    
                //Evaluation of the total height of the report
                //We always need to print a single strip, regardless of whether it is 5 inches or 200 inches long.
                if (flexReport.Layout.PaperSize == PaperKind.Custom && flexReport.Layout.ColumnLayout != ColumnLayoutEnum.Labels)
                {
                    flexReport.Layout.CustomHeight = 0;
                }
    
                //Render Report
                flexReport.Render();
                
                //Print
                flexReport.DefaultPrintOptions.PrinterSettings = new PrinterSettings
                {
                    PrinterName = "EPSON TM-T20II Receipt5",
                    Copies = 1,
                };
                flexReport.DefaultPrintOptions.PageSettings = flexReport.PageSettings.ToPageSettings(flexReport.DefaultPrintOptions.PrinterSettings);
    
    
    

    As soon as I have the certainty I will publish the result, because I believe it can be useful to others.

    Best Regards, Marco

  • Posted 17 June 2020, 7:26 am EST

    Hi Marco,

    It’s good to hear that the issue has been resolved at your end. In case if you face any issue then please let us know.

    @Wolfgang, thank you so much for your help.

    Regards,

    Prabhat Sharma.

Need extra support?

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

Learn More

Forum Channels