How to print formatted html in Linux server

核能气质少年 提交于 2020-01-11 13:01:51

问题


ASP.NET MVC 4 application runs in Debian Squeeze Linux using Mono.

Controller creates html document like code below. html contains simple positioning divs and formatting instructions.

Linux server is running in internet provider and there are no desktop components installed. Additional components can installed if required. This is older, squeze x64 linux.

How to print this html file to Samsung printer connected to server ?

It there some executable which can used for this ? wkhtmltopdf and wkhtmltoimage do not have print options.

       public class Test: Controller {
        public ActionResult Print()
        {
            PrintOrderVormiga();
            return new ContentResult() { Content = "OK" };
        }

        void PrintOrderVormiga()
        {
    sb = new StringBuilder();
    sb.Insert(0, " <b>test</b> ", 500);
            var doc = new PrintDocument();
            doc.PrinterSettings.PrinterName = "Samsung ML-331x Series";
            doc.PrintPage += new PrintPageEventHandler(ProvideContent);
            doc.Print();
        }

        StringBuilder sb;

        void ProvideContent(object sender, PrintPageEventArgs e)
        {
          ?? how to print sb.ToString() as formatted html ?
        }
  }

来源:https://stackoverflow.com/questions/33717210/how-to-print-formatted-html-in-linux-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!