static void Main(string[] args)
        {
            Console.WriteLine("Initializing local jsreport.exe utility");
            var rs = new LocalReporting()
                     .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport"))
                     .KillRunningJsReportProcesses()
                     .UseBinary(JsReportBinary.GetBinary())
                     .Configure(cfg => cfg.AllowLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory())
                     .AsWebServer()
                     .Create();

            rs.StartAsync().Wait();
            Console.ReadKey();

            Console.WriteLine("Rendering localy stored template jsreport/data/templates/Invoice into invoice.pdf");
            var invoiceReport = rs.RenderByNameAsync("Invoice", InvoiceData).Result;

            invoiceReport.Content.CopyTo(File.OpenWrite("invoice.pdf"));

            Console.WriteLine("Rendering custom report fully described through the request object into customReport.pdf");
            var customReport = rs.RenderAsync(CustomRenderRequest).Result;

            customReport.Content.CopyTo(File.OpenWrite("customReport.pdf"));

            byte[] pdfByte = ReadFully(customReport.Content);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var jsreportDirectory = Path.Combine(System.Environment.CurrentDirectory.Substring(0, System.Environment.CurrentDirectory.LastIndexOf("bin")), "jsreport");

            Console.WriteLine("Starting jsreport in " + jsreportDirectory);

            var rs = new LocalReporting()
                     .UseBinary(JsReportBinary.GetBinary())
                     .KillRunningJsReportProcesses()
                     .RunInDirectory(jsreportDirectory)
                     .Configure(cfg => cfg.CreateSamples()
                                .FileSystemStore()
                                .BaseUrlAsWorkingDirectory())
                     .AsWebServer()
                     .RedirectOutputToConsole()
                     .Create();

            rs.StartAsync().Wait();

            Process.Start(new ProcessStartInfo("cmd", $"/c start http://localhost:5488"));

            Console.ReadKey();

            rs.KillAsync().Wait();
        }
Beispiel #3
0
        static async task Main(string[] args)
        {
            var rs = new LocalReporting()
                     .UseBinary(JsReportBinary.GetBinary())
                     .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport"))
                     .KillRunningJsReportProcesses()
                     .Configure(cfg => cfg.CreateSamples().FileSystemStore())
                     .AsWebServer()
                     .RedirectOutputToConsole()
                     .Create();


            await rs.StartAsync();

            Console.ReadKey();
            await rs.KillAsync();
        }