public ManagedXpsDocument(Uri packageUri, Package package, ReportContentDefinition xpsHeaderAndFooterDefinition, ReportProperties reportProperties)
     : base(package, CompressionOption.SuperFast, packageUri.ToString())
 {
     this.PackageUri = packageUri;
     RegisterAtPackageStoreWith(package, packageUri);
     this._xpsHeaderAndFooterDefinition = xpsHeaderAndFooterDefinition;
     this._reportProperties             = reportProperties;
 }
Beispiel #2
0
        public static Task GetPdfReportFromObjectListAsync <T>(ReportProperties reportProperties, IEnumerable <T> dataSourceObjectList, CancellationToken token = default, IProgress <double> progress = null)
        {
            var taskCompletionSource = new TaskCompletionSource <object>();
            var thread = new Thread(() => GetPdfReportFromObjectList(reportProperties, dataSourceObjectList, token, progress));

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            return(taskCompletionSource.Task);
        }
Beispiel #3
0
        public static void CreatePdfReportFromObjectList <T>(ReportProperties reportProperties, IEnumerable <T> dataSourceObjectList, CancellationToken cancellationToken = default, IProgress <double> progressReporter = null)
        {
            if (dataSourceObjectList == null)
            {
                throw new ArgumentNullException(nameof(dataSourceObjectList));
            }
            _cancellationToken = cancellationToken;
            _progressReporter  = progressReporter;

            var xpsDocumentSplicer = new XpsDocumentSplicer(reportProperties);

            Fill(ref xpsDocumentSplicer, dataSourceObjectList);
            if (IsCancellationRequested())
            {
                return;
            }

            SaveAsPdf(xpsDocumentSplicer, reportProperties.OutputDirectory);
            FinishProgress();
        }
Beispiel #4
0
        public static FileStream GetPdfReportFromObjectList <T>(ReportProperties reportProperties, IEnumerable <T> dataSourceObjectList, CancellationToken cancellationToken = default, IProgress <double> progressReporter = null)
        {
            if (dataSourceObjectList == null)
            {
                throw new ArgumentNullException(nameof(dataSourceObjectList));
            }
            _cancellationToken = cancellationToken;
            _progressReporter  = progressReporter;

            var xpsDocumentSplicer = new XpsDocumentSplicer(reportProperties);

            Fill(ref xpsDocumentSplicer, dataSourceObjectList);
            if (IsCancellationRequested())
            {
                return(null);
            }

            FileStream pdfFileStream = GetAsPdfFileStream(xpsDocumentSplicer);

            FinishProgress();
            return(pdfFileStream);
        }
Beispiel #5
0
 public static async Task GetPdfReportFromObjectAsync <T>(ReportProperties reportProperties, T dataSourceObject, CancellationToken token = default, IProgress <double> progress = null)
 {
     await GetPdfReportFromObjectListAsync(reportProperties, new List <T> {
         dataSourceObject
     }, token, progress).ConfigureAwait(false);
 }
Beispiel #6
0
 public XpsDocumentSplicer(ReportProperties reportProperties)
 {
     this._reportProperties = reportProperties;
 }