We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Slow saving to file with a large table

Hello
I have problem with pdf with table.
I’m waiting about 30 seconds when I add 20000 rows and 6 minuts when I try save to file.

Please look at this code:

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

Aspose.Pdf.Generator.Table table = new Aspose.Pdf.Generator.Table();

table.ColumnWidths = “30 30 30 30 30 30 30 30 30”;

for (int i = 1; i <= 20000; i++)
{
Aspose.Pdf.Generator.Row row = table.Rows.Add();

row.Cells.Add(Convert.ToString(i));
row.Cells.Add(“1”);
row.Cells.Add(“2”);
row.Cells.Add(“3”);
row.Cells.Add(“4”);
row.Cells.Add(“5”);
row.Cells.Add(“6”);
row.Cells.Add(“7”);
row.Cells.Add(“8”);
}

section.Paragraphs.Add(table);

pdf.Save(@“C:\Windows\Temp\test.pdf”); //I’m waiting 6 minutes

Hi Marek,


Thanks for your inquiry. I have tested your code with Aspose.Pdf for .NET 9.8.0 over Win 7 64 bit, 8GB RAM and VS2010, I am unable to notice long processing time, it took almost ~100 sec at my end. Please download latest version of Aspose.Pdf for .NET, hopefully it will resolve the issue. If issue persist then please share details about your environment, so we will investigate it further and guide you accordingly.

Moreover, We will suggest your to use new Genearator(Aspose.Pdf). It is more efficient and improved. I have tested your scenario with new generator and it is taking almost 75 seconds.

Document pdf1 = new
Document();<o:p></o:p>

Page section1 = pdf1.Pages.Add();

Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();

table1.ColumnWidths = "30 30 30 30 30 30 30 30 30";

for (int i = 1; i <= 20000; i++)

{

Aspose.Pdf.Row row = table1.Rows.Add();

row.Cells.Add(Convert.ToString(i));

row.Cells.Add("1");

row.Cells.Add("2");

row.Cells.Add("3");

row.Cells.Add("4");

row.Cells.Add("5");

row.Cells.Add("6");

row.Cells.Add("7");

row.Cells.Add("8");

}

section1.Paragraphs.Add(table1);

pdf1.Save(myDir + "newgentable_time.pdf");

Best Regards,