PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Oct 23, 2017 10:15 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue May 22, 2012 1:50 am 
Offline

Joined: Thu May 10, 2012 11:52 pm
Posts: 7
I got a document with a table which has 1200 rows and 3 columns. I also have a simple header and a footer. This is the part of the code where I render the document:

Code:
                TimeSpan first;
                TimeSpan second;
                Stopwatch sw = new Stopwatch();
                sw.Start();
                document.UseCmykColor = true;
                const bool unicode = false;
                const PdfFontEmbedding embedding = PdfFontEmbedding.Always;
                PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(unicode, embedding);
                pdfRenderer.Document = document;
                pdfRenderer.RenderDocument();
                sw.Stop();
                first = sw.Elapsed;
                sw.Start();
                MemoryStream stream = new MemoryStream();
                pdfRenderer.Save(stream, false);
                StringBuilder sb = new StringBuilder();
                sw.Stop();
                second = sw.Elapsed;


First = 1 minute 53 seconds
Second= 1 second

this is how I add rows to a table:
Code:
 foreach (var name in names)
           {

               Row row1 = table.AddRow();
               row1.Cells[1].AddParagraph(name.ToString());

           }


is there any solution to this problem?


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 02, 2015 11:24 am 
Offline

Joined: Wed Sep 02, 2015 10:56 am
Posts: 2
if its still relevant

viewtopic.php?f=2&t=679


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 7:16 am 
Offline
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 287
Location: CCAA
mr_Hilter wrote:
if its still relevant
Now we have two solutions for the problem: with PDFsharp 1.50 beta 2, MigraDoc table rendering got much faster.


For my tests I used test code that creates a PDF with 26 pages, containing a single table with 666 rows that runs from page 2 through page 25.
Test routine creates six such documents and shows the time required for each document.
First document takes a bit slower, maybe due to assembly initialization and JIT compiling.

Speed gain will be smaller for documents containing much text outside tables or containing no tables at all.

PDFsharp + MigraDoc WPF 1.32.2608:
Average: 24.443 seconds
MigraDoc-1.32-patched-release (WPF) from Pakeha:
Average: 9.114 seconds
PDFsharp + MigraDoc (WPF) 1.50.3638-beta:
Average: 16.114 seconds
PDFsharp + MigraDoc (WPF) 1.50.3915-beta2:
Average: 1.559 seconds

I do not publish my test code at this time. I am looking forward to seeing test results from others.

The detailed timing for those who care:
PDFsharp + MigraDoc WPF 1.32.2608:
Creating document #0
Time: 25.131
Creating document #1
Time: 24.245
Creating document #2
Time: 24.272
Creating document #3
Time: 24.421
Creating document #4
Time: 24.158
Creating document #5
Time: 24.433



MigraDoc-1.32-patched-release (WPF) from Pakeha:
Creating document #0
Time: 9.761
Creating document #1
Time: 8.967
Creating document #2
Time: 8.987
Creating document #3
Time: 8.986
Creating document #4
Time: 8.999
Creating document #5
Time: 8.985


PDFsharp + MigraDoc (WPF) 1.50.3638-beta:
Creating document #0
Time: 16.756
Creating document #1
Time: 15.944
Creating document #2
Time: 15.972
Creating document #3
Time: 15.987
Creating document #4
Time: 16.026
Creating document #5
Time: 16.001

PDFsharp + MigraDoc (WPF) 1.50.3915-beta2:
Creating document #0
Time: 2.223
Creating document #1
Time: 1.427
Creating document #2
Time: 1.436
Creating document #3
Time: 1.425
Creating document #4
Time: 1.418
Creating document #5
Time: 1.423

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot], troyzirk and 6 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:  
Powered by phpBB® Forum Software © phpBB Group