PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon May 06, 2024 9:16 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Jul 01, 2009 3:52 pm 
Offline

Joined: Fri May 15, 2009 10:33 pm
Posts: 6
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


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 01, 2009 4:39 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 70 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group