Exemple #1
0
        public PdfGenerator(
            IPdfOptionsService pdfOptionsService,
            IOptionsMonitor <PdfOptions> pdfOptionsMonitor,
            IOptionsMonitor <PdfGeneratorOptions> pdfGeneratorMonitor)
        {
            _pdfOptionsMonitor   = pdfOptionsMonitor;
            _pdgGeneratorOptions = pdfGeneratorMonitor.CurrentValue;

            pdfGeneratorMonitor.OnChange(o => _pdgGeneratorOptions = o);

            _pdfOptionsService = pdfOptionsService ?? throw new System.ArgumentNullException(nameof(pdfOptionsService));
        }
Exemple #2
0
 public static IServiceCollection AddPdfGenerator(this IServiceCollection services, PdfGeneratorOptions options, IWebProxy webProxy)
 {
     return(services
            .AddSingleton <IChartBuilder, ChartJsBuilder>()
            .AddSingleton <IPdfGeneratorHttpClient>(_ => new PdfGeneratorHttpClient(options)
     {
         Proxy = webProxy
     })
            .AddTransient <IRequestBuilder, RequestBuilder>()
            .AddTransient <IReportBuilder, ReportBuilder>()
            .AddTransient <ITableBuilder, TableBuilder>());
 }
Exemple #3
0
 public PdfGeneratorAuthenticator(PdfGeneratorOptions PdfGeneratorOptions)
 {
     this.Options = PdfGeneratorOptions;
 }
 public PdfGeneratorHttpClient(PdfGeneratorOptions options) : this(new PdfGeneratorAuthenticator(options))
 {
 }
 /// <summary>
 /// Uses: configuration["PdfGenerator:AccessToken"]
 /// </summary>
 /// <param name="configuration"></param>
 public PdfGeneratorHttpClient(IConfiguration configuration) : this(PdfGeneratorOptions.Create(configuration[$"PdfGenerator:{nameof(PdfGeneratorOptions.AccessToken)}"], configuration[$"PdfGenerator:{nameof(PdfGeneratorOptions.ApplicationId)}"], configuration[$"PdfGenerator:{nameof(PdfGeneratorOptions.ApplicationId)}"]))
 {
 }
 public PdfGenerator(IOptions <PdfGeneratorOptions> options, IPdfOptionsConverter converter)
 {
     _pdfGeneratorOptions = options.Value;
     _converter           = converter;
 }