PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Loading Image while Generating PDF? https://forum.pdfsharp.net/viewtopic.php?f=2&t=773 |
Page 1 of 1 |
Author: | bakardi [ Wed Jul 01, 2009 3:52 pm ] |
Post subject: | Loading Image while Generating PDF? |
Hey all, I am generating pdf's dynamically to great effect using PDF-Sharp. My only concern now is that some of these PDF's take up to 5 minutes to generate depending on how many pages and how many rows of data is used. Is there any way to have a loading image display when the PDF is being generated? What different types of things are you guys doing for your users while the PDF is created? Thanks, K |
Author: | Thomas Hoevel [ Wed Jul 01, 2009 4:39 pm ] |
Post subject: | Re: Loading Image while Generating PDF? |
Hi! We show a gauge control. Phase 1 is preparation of the document (gauge running from 0% to 100%). We use the PrepareDocumentProgress event of DocumentRenderer for this: Code: this.docRenderer = new DocumentRenderer(this.doc); this.ProgressCompleted = 5; // Magic: start at 5% this.ProgressPrepare = 95; this.docRenderer.PrepareDocumentProgress += new DocumentRenderer.PrepareDocumentProgressEventHandler(PrepareDocumentProgressEventHandler); this.docRenderer.PrepareDocument(); Then we create the PDF file page by page (phase 2) - also with gauge control from 0% to 100%: Code: int pageCount = this.docRenderer.FormattedDocument.PageCount; [...] for (int idx = 0; idx < pageCount; idx++) { DocumentObject[] docObjects = this.docRenderer.GetDocumentObjectsFromPage(idx + 1); [...] this.docRenderer.RenderPage(gfx, idx + 1, options); } Phase 1 takes more time than phase 2. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |