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

Free Support Forum - aspose.com

Huge Records - Pdf conversion issues

Hi,


Currently we are trying your evaluation version of the pdf component and we have almost zeroed in your component. we are buying it very soon.

One of our requirements was to convert huge records as big as 8 lakhs records into pdf and when we tried to do it through a desktop application we are experiencing extreme slowness and files are never written.

if we try to write less than smaller set of records such as 4000 ( more than 400 pages of pdf ) records it is working fine without any issues

Please help us on this issue as soon as possible as this will determine our purchasing decision heavily.

Thanks,
Ganapathi

sample code :

<span style=“font-size:10.0pt;font-family:“Courier New”;
color:blue”>private<span style=“font-size:10.0pt;font-family:“Courier New””>
Stream Response;<o:p></o:p>

Aspose.Pdf.Generator.Pdf PdfRpt;

public void GeneratePDF()

{

string strExpFileName = System.Text.RegularExpressions.Regex.Replace(GetLabel(TempTitle), @"[^\w,\.@]", "");

FormatHeaderArray();

strExpFileName = strExpFileName + ReportDate.Substring(0, 10).Replace("-", "").Replace(" ", "");

if (enumRptType == ReportType.DataOnly)

{

ConvertHeadersDataOnly();

}

else

{

ConvertHeaders();

}

calculateMaxwidth();

PdfRpt = new Aspose.Pdf.Generator.Pdf();

Aspose.Pdf.License lic = new Aspose.Pdf.License();

lic.SetLicense("Aspose.Pdf.lic");

PdfRpt.PageSetup.PageWidth = (float)maxwidth + 40;

PdfRpt.PageSetup.PageHeight = PageSize.A4Width;

PdfRpt.PageSetup.Margin.Left = 10;

PdfRpt.PageSetup.Margin.Right= 10;

sec1 = PdfRpt.Sections.Add();

ReportPDF();

PdfRpt.Save(Response);

//throw new Exception("Exception Occured while generating PDF");

}

private void ReportPDF()

{

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

sec1.Paragraphs.Add(pTableGrp);

pTableGrp.ColumnWidths = (maxwidth +10 ).ToString();

row1 = pTableGrp.Rows.Add();

Cell pCellGrp = row1.Cells.Add();

pCellGrp.Paragraphs.Add(FillGroupHeaderSection(DrGroups));

pCellGrp.Border = new BorderInfo((int) (BorderSide.None));

row1 = pTableGrp.Rows.Add();

pCellGrp = row1.Cells.Add();

pCellGrp.Paragraphs.Add(FillDetailHeadSection());

pCellGrp.Padding = getPadding(5);

row1 = pTableGrp.Rows.Add();

pCellGrp = row1.Cells.Add();

}



I get the folowing error message


Exception Message<o:p></o:p>

Key cannot be null.

Parameter name: key

Exception Stack trace

at System.Collections.Hashtable.get_Item(Object key)

at Aspose.Pdf.Generator.TextInfo.get_FontSize()

at .›.[1](Text , Pdf , , Int32 , Segment , Int32 )

at .›.[1](Pdf , Section , Table , Row , Cell , Text , , [1] , Boolean )

at ..[1](Pdf , Section , HeaderFooter , Table , Row , Cell , Text , , [1] , Boolean )

at .­.[1](Pdf , Section , Table , Row , Cell , , [1] )

at .


[1].[1](Pdf , Section , Table , Row , , [1] )

at ..[1](Pdf doc, Section currentPart, HeaderFooter hf, Table table, assignInfo, [1] useType, Boolean isFirst, & breakTableNextPart)

at .­.[1](Pdf , Section , Table , Row , Cell , , [1] )

at .


[1].[1](Pdf , Section , Table , Row , , [1] )

at ..[1](Pdf doc, Section currentPart, HeaderFooter hf, Table table, assignInfo, [1] useType, Boolean isFirst, & breakTableNextPart)

at .[1].[1](Pdf , Section , )

at .†.[1](Pdf )

at .Ž.[1]( , Pdf )

at Aspose.Pdf.Generator.Pdf.Save(Stream stream)

at HTMLReportGenerator.APDFReport.GeneratePDF()

Hi Ganapathi,


Sorry for the delayed response.

I am working over this query and will get back to you soon. We are sorry for your inconvenience.

Hi Ganapathi,


I have tested this scenario in details and have found that, when adding 70,000 rows with 3 columns inside PDF document, the resultant PDF is properly being generated. However when I have tried adding 90,000 rows in table, an Exception is being generated. For the sake of correction, I have logged this problem as PDFNEWNET-33874 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for you inconvenience.

Please note that I tried using the code snippet that you have shared but there are some methods for which I am not certain so I have used the following code snippet to test the scenario.

[C#]

Aspose.Pdf.Generator.Pdf
pdf = new Aspose.Pdf.Generator.Pdf();<o:p></o:p>

//Add a section to the PDF document

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

//Instantiate a table object

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

//Add the table in paragraphs collection of the desired section

sec1.Paragraphs.Add(tab1);

//Set with column widths of the table

tab1.ColumnWidths = "80 120 120 120";

//Set default cell border using BorderInfo object

tab1.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 0.1F);

//Set table border using another customized BorderInfo object

tab1.Border = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 1F);

//Create MarginInfo object and set its left, bottom, right and top margins

Aspose.Pdf.Generator.MarginInfo margin = new Aspose.Pdf.Generator.MarginInfo();

margin.Top = 5f;

margin.Left = 5f;

margin.Right = 5f;

margin.Bottom = 5f;

//Set the default cell padding to the MarginInfo object

tab1.DefaultCellPadding = margin;

//Add 1000 text paragraphs to the section

for (int i = 0; i < 90000; i++)

{

//Create rows in the table and then cells in the rows

Aspose.Pdf.Generator.Row row = tab1.Rows.Add();

row.Cells.Add("Sr. #" + (i+1).ToString());

row.Cells.Add("Cell ("+i.ToString()+","+i.ToString()+")");

row.Cells.Add("Cell ("+i.ToString()+","+(i+1).ToString()+")");

row.Cells.Add("Cell ("+i.ToString()+","+(i+2).ToString()+")");

}

// save the PDF document

pdf.Save("d:/pdftest/LargeSizePdf.pdf");

Thanks For the Reply.


PLease remember that we will have to produce high volume pdfs to the extent of about 7 or 8 lakhs record and let us know the upper limit for pdf generation.

Awaiting your reply

Thanks,
Ganapathi


Hi Shabaz ,

Is it due to the evaluation copy ? pls check if this is the reason.

thx.
Irfan.

Hi Ganapathi,


During my earlier testing, I managed to produce the PDF document with 70,000 rows of record but I am afraid it started failing with any value greater than that. Nevertheless, I am in coordination with the development team to figure out the scenario in which we can add a huge amount of record i.e. at least more than 100,000 and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for your inconvenience.

Hi Ganapathi,


Thanks for your patience.

In order to generate a PDF file with large number of records i.e. 90 thousand rows, please try using the approach specified below.

[C#]

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

Page page = doc.Pages.Add();

//Instantiate a table object

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

//Set with column widths of the table

tab1.ColumnWidths = "80 120 120 120";

//Set default cell border using BorderInfo object

tab1.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);

//Set table border using another customized BorderInfo object

tab1.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1F);

//Create MarginInfo object and set its left, bottom, right and top margins

Aspose.Pdf.MarginInfo margin = new Aspose.Pdf.MarginInfo();

margin.Top = 5f;

margin.Left = 5f;

margin.Right = 5f;

margin.Bottom = 5f;

//Set the default cell padding to the MarginInfo object

tab1.DefaultCellPadding = margin;

//Add 1000 text paragraphs to the section

for (int i = 0; i < 90000; i++)

{

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

row.Cells.Add("Sr. #" + (i + 1).ToString());

row.Cells.Add("Cell (" + i.ToString() + "," + i.ToString() + ")");

row.Cells.Add("Cell (" + i.ToString() + "," + (i + 1).ToString() + ")");

row.Cells.Add("Cell (" + i.ToString() + "," + (i + 2).ToString() + ")");

}

page.Paragraphs.Add(tab1);

doc.Save(“c:/pdftest/90ThousandRowTable.pdf”);

The issues you have found earlier (filed as PDFNEWNET-33874) have been fixed in Aspose.Pdf for .NET 8.2.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.