PDFsharp & MigraDoc Foundation

table rendering performance
Page 1 of 1

Author:  BeSt [ Mon Mar 26, 2018 3:45 pm ]
Post subject:  table rendering performance

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?

MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, "MigraDoc.mdddl")
Dim pdfRenderer As PdfDocumentRenderer = New PdfDocumentRenderer()
pdfRenderer.Document = document

The most time consuming line is
pdfRenderer.Document = document

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

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


Author:  Thomas Hoevel [ Mon Mar 26, 2018 4:16 pm ]
Post subject:  Re: table rendering performance


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.

Author:  BeSt [ Mon Mar 26, 2018 4:27 pm ]
Post subject:  Re: table rendering performance

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!


Author:  Thomas Hoevel [ Tue Mar 27, 2018 8:41 am ]
Post subject:  Re: table rendering performance

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:

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group