如何从Web Api中的Stimulsoft打印页面而不进行打印预览

时间:2018-07-06 14:01:50

标签: c# asp.net-web-api printing stimulsoft print-preview

当我键入此URL并打印所需文档时,我想运行打印命令。

这是调用此方法的网址:

http://localhost:9090/api/printPage

Api方法

[HttpGet]
[Route("PrintPage")]
public boolean PrintPage()
{
    try
    {       
        var p = new List<Person>()
        {
            new Person() {Id = 1, FirstName = "omid", LastName = "nasri", Gender = true}
            , new Person() {Id = 2, FirstName = "hana", LastName = "akbari", Gender = false}
            , new Person() {Id = 3, FirstName = "ali", LastName = "jahani", Gender = true }
            , new Person() {Id = 4, FirstName = "sara", LastName = "sabori", Gender = false }
        };

        var mainReport = new StiReport();

        mainReport.Load(@"D:\WebSite\Web\Print\Report.mrt");
        mainReport.RegBusinessObject("persons" , p);

        mainReport.Print(false);

        return true;
    }
    catch (Exception ex)
    {
        return false;
    }    
}

Screen Shot Business Object persons

我使用stimulsoft 2012.1。

0 个答案:

没有答案