PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 5:46 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: RenderDocument Too sLow
PostPosted: Sun May 04, 2008 7:51 pm 
Offline

Joined: Sun May 04, 2008 7:36 pm
Posts: 1
Location: Argentina
Hello...

I'm building a Table in a PDF Document in a ASP.NET 2.0 Web Site with then MigraDoc.DocumentObjectModel.Document.

I make a Table with 400 rows (more or less) and when I Render the Document it uses 100% of CPU and it taking a long time to resolve this.

This is my Document generation code.

// Create a new MigraDoc document
Document document = new Document();

document.Info.Title = "MyFileName";
document.Info.Subject = "MySubject";
document.Info.Author = "MyAuthor";
Section section = document.Sections.AddSection();

Table table = new Table();
table.Borders.Width = 0.75;
table.Format.Font.Size = 8;

Column column;
for (Int32 i = 0; i < Headers.Length;i++ ) //Headers is an Array with the Headers List Names
{
column = table.AddColumn(Unit.FromCentimeter(2));
switch (dt.Columns[i].DataType.FullName)
{
case "System.Decimal":
case "System.Int16":
case "System.Int32":
case "System.Int64":
case "System.Double":
column.Format.Alignment = ParagraphAlignment.Right;
break;
case "System.DateTime":
column.Format.Alignment = ParagraphAlignment.Center;
break;
default:
column.Format.Alignment = ParagraphAlignment.Left;
break;
}
}

//Header Row
Row row = table.AddRow();
Cell cell;
row.Shading.Color = Colors.PaleGoldenrod;
for (int i = 0; i < Headers.Length; i++)
{
cell = row.Cells[i];
cell.AddParagraph(Headers[i]);
}

//Data Rows
foreach (DataRow oRow in dt.Rows) //dt is a DataTable
{
row = table.AddRow();
for (int i = 0; i < Headers.Length; i++)
{
cell = row.Cells[i];
cell.AddParagraph(Convert.ToString(oRow[i]));
}
}

table.SetEdge(0, 0, Headers.Length, dt.Rows.Count, Edge.Box, BorderStyle.Single, 1.5, Colors.Black);

table.KeepTogether = false;

section.Add(table);

PdfDocumentRenderer renderer = new PdfDocumentRenderer();
renderer.Document = document;
renderer.RenderDocument(); //Here is the Slow code

There is something wrong?
Thanks afterhand
CarlosMag


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 8:11 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hello!

This is a known issue.
Previous discussion
This will be optimized in a future release of PDFsharp.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC


Who is online

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