internal LocalUtilityReporting(IReportingBinary binary, Configuration cfg, string cwd, IContractResolver contractResolverForDataProperty)
 {
     _binary = binary;
     _cfg    = cfg;
     _cwd    = cwd;
     _contractResolverForDataProperty = contractResolverForDataProperty;
 }
예제 #2
0
        public static IServiceCollection AddPdfRendering(this IServiceCollection services)
        {
            IReportingBinary binary = null;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                binary = JsReportBinary.GetBinary();
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                binary = jsreport.Binary.OSX.JsReportBinary.GetBinary();
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                binary = jsreport.Binary.Linux.JsReportBinary.GetBinary();
            }

            services.AddJsReport(new LocalReporting()
                                 .UseBinary(binary)
                                 .KillRunningJsReportProcesses()
                                 .AsUtility()
                                 .Create());

            return(services);
        }
예제 #3
0
        internal LocalUtilityReportingService(IReportingBinary binary, string cwd = null, Configuration configuration = null)
        {
            _tempPath = Path.Combine(configuration.TempDirectory ?? Path.Combine(Path.GetTempPath(), "jsreport"), "autocleanup");
            Directory.CreateDirectory(_tempPath);

            _binaryProcess = new BinaryProcess(binary, cwd, configuration);

            AppDomain.CurrentDomain.DomainUnload += DomainUnloadOrProcessExit;
            AppDomain.CurrentDomain.ProcessExit  += DomainUnloadOrProcessExit;
        }
        internal LocalUtilityReportingService(IReportingBinary binary, Configuration configuration, bool keepAlive, string cwd = null, IContractResolver dataContractResolver = null)
        {
            _dataContractResolver = dataContractResolver;
            _keepAlive            = keepAlive;
            _tempPath             = Path.Combine(configuration.TempDirectory, "autocleanup");
            Directory.CreateDirectory(_tempPath);

            _binaryProcess = new BinaryProcess(binary, configuration, cwd);

            AppDomain.CurrentDomain.DomainUnload += DomainUnloadOrProcessExit;
            AppDomain.CurrentDomain.ProcessExit  += DomainUnloadOrProcessExit;
        }
        internal BinaryProcess(IReportingBinary binary, string cwd = null, Configuration cfg = null)
        {
            _binary       = binary;
            Configuration = cfg ?? new Configuration();
            // GetEntryAssembly works in .net core, GetExecutingAssembly in the full .net asp.net
            var    entryAssembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
            string codeBase      = entryAssembly.CodeBase.Replace("file:///", "");
            var    binDir        = Path.GetDirectoryName(codeBase);

            _workingPath = cwd ?? Path.Combine(binDir, "jsreport");
            if (!Directory.Exists(_workingPath))
            {
                Directory.CreateDirectory(_workingPath);
            }
        }
        internal LocalWebServerReportingService(IReportingBinary binary, string cwd = null, Configuration configuration = null)
        {
            _binaryProcess = new BinaryProcess(binary, cwd, configuration);

            _binaryProcess.Configuration.HttpPort = _binaryProcess.Configuration.HttpPort ?? 5488;
            LocalServerUri    = "http://localhost:" + _binaryProcess.Configuration.HttpPort;
            _reportingService = new ReportingService(LocalServerUri, _binaryProcess?.Configuration?.Authentication?.Admin?.Username,
                                                     _binaryProcess?.Configuration?.Authentication?.Admin?.Password);
            StartTimeout = new TimeSpan(0, 0, 0, 20);
            StopTimeout  = new TimeSpan(0, 0, 0, 3);
            _binaryProcess.OutputDataReceived += (s, e) => {
                _startOutputLogs += e.Data;
                OutputDataReceived?.Invoke(s, e);
            };
            _binaryProcess.ErrorDataReceived += (s, e) => {
                _startErrorLogs += e.Data;
                OutputDataReceived?.Invoke(s, e);
            };

            AppDomain.CurrentDomain.DomainUnload += DomainUnloadOrProcessExit;
            AppDomain.CurrentDomain.ProcessExit  += DomainUnloadOrProcessExit;
        }
 public LocalReporting UseBinary(IReportingBinary binary)
 {
     _binary = binary;
     return(this);
 }
예제 #8
0
 internal LocalUtilityReporting(IReportingBinary binary, string cwd, Configuration cfg)
 {
     _binary = binary;
     _cfg    = cfg;
     _cwd    = cwd;
 }