PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 2:07 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Mar 26, 2018 3:45 pm 
Offline

Joined: Thu Jan 14, 2016 11:55 am
Posts: 6
Hi folks.

I know, that this subject has been discussed a lot, but I donĀ“t know if the "error" is perhaps "on my side"...

So what is the problem:
I am trying to generate some PDFs which consist mainly of tables. The length of the table can vary from 12 columns, 4 rows up to 12 columns 3000-4000 rows. I know that table rendering is very complicated and a bit slow with MigraDoc.

My performance is:
Generating the whole document (adding paragraphs, tables, formats, images and so on) in less then 1 second. After that, rendering starts and this rendering-process takes for the smallest version mentioned above about 6-7 seconds.
A larger version with about 500 table rows takes about 30 seconds.
A huge version of the table takes some minutes!

Please have a look at my "rendering code lines"... are these correct?

Code:
MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, "MigraDoc.mdddl")
Dim pdfRenderer As PdfDocumentRenderer = New PdfDocumentRenderer()
pdfRenderer.Document = document
pdfRenderer.RenderDocument()
pdfRenderer.PdfDocument.Save(fileName)


The most time consuming line is
Code:
pdfRenderer.Document = document
.

So is ist possible to speed up this "rendering process"?

I hope I could describe what my problem is...

Regards
BeSt


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 26, 2018 4:16 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
Hi!

If you already use the latest MigraDoc version (1.50 RC1) then there is not much you can do.

1. Remove the call to "DdlWriter.WriteToFile" - that's for debugging only.
2. You can show a progress bar while rendering to make the time appear shorter (as there is something moving on the screen).
See here: viewtopic.php?f=8&t=3172
3. If there is a speed difference between GDI build and WPF build then use the faster one.
4. Buy a faster computer.

"pdfRenderer.Document = document" should be quick and "pdfRenderer.RenderDocument()" should be the slow one.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 26, 2018 4:27 pm 
Offline

Joined: Thu Jan 14, 2016 11:55 am
Posts: 6
Hi Thomas.

Thank you for your real quick answer!
Fantastic how fast you replied!

Of course you are right - pdfRenderer.RenderDocument() is the slow one.

I am using version 1.50.4740 - is this the newst RC1?

So I will display the progress bar... Thank you!

Regards
BeSt


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 27, 2018 8:41 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
BeSt wrote:
I am using version 1.50.4740 - is this the newst RC1?
The latest version is 1.50.4820-RC1, but table rendering was not optimized in the past few months.
I just wanted to make sure you are not using version 1.32. :wink:

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 48 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