|
PDFsharp - moved to http://forum.pdfsharp.net/ Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
|
Important Notice:
We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024.
If you wish to migrate to our paid hosting service, please contact billing@hostonnet.com.
View previous topic :: View next topic |
Author |
Message |
CarlosMag
Joined: 04 May 2008 Posts: 1 Location: Argentina
|
Posted: Sun May 04, 2008 7:51 pm Post subject: RenderDocument Too sLow |
|
|
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 |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: Mon May 05, 2008 8:11 am Post subject: |
|
|
Hello!
This is a known issue.
Previous discussion
This will be optimized in a future release of PDFsharp. _________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
|
|
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 vote in polls in this forum
|
|