I am using aspose.pdf dll for generating pdf in .net from HTML (which I received from DB.)
Everything was working fine till
today morning. Suddenly save method of object pdf class is taking more
and more time.
Previously it was saved in 4 to 5 sec max now it took 4 to 5 min 1 time. And next time it’s taking time (9min +),no any exception or anything is get thrown From this save method. Below is the code that which I am using .
Please help me as this issue is suddenly coming on production , UAT and on my local machine too.
Version of dll is 9.9.0.0 Below is the code and yellow line highlighted where my cursor goes and hangs
pdf1 = newPdf();
DataTable dt = newDataTable();
DataTable dt1 = newDataTable();
dt =
objEntryScreen.GetROIData(obj);
dt1 =
objEntryScreen.GetDataFromMaster(obj);
string Path = Server.MapPath(ConfigurationManager.AppSettings["Mypath"]);
string[] filePaths = Directory.GetFiles(Path);
string Licence = Server.MapPath(ConfigurationManager.AppSettings["Licence"]);
Aspose.Pdf.License license = new
Aspose.Pdf.License();
license.SetLicense(Licence + "Aspose.Pdf.lic");
Section sec1 = pdf1.Sections.Add();
Section sec2 = pdf1.Sections.Add();
Section sec3 = pdf1.Sections.Add();
Aspose.Pdf.Generator.HeaderFooter footer1 = new Aspose.Pdf.Generator.HeaderFooter(sec1);
Aspose.Pdf.Generator.HeaderFooter footer2 = new Aspose.Pdf.Generator.HeaderFooter(sec2);
Aspose.Pdf.Generator.HeaderFooter footer3 = new Aspose.Pdf.Generator.HeaderFooter(sec3);
Aspose.Pdf.Generator.HeaderFooter footer6 = new Aspose.Pdf.Generator.HeaderFooter(sec1);
Aspose.Pdf.Generator.HeaderFooter footer7 = new Aspose.Pdf.Generator.HeaderFooter(sec2);
Aspose.Pdf.Generator.HeaderFooter footer8 = new Aspose.Pdf.Generator.HeaderFooter(sec3);
sec1.OddFooter
= footer1;
sec1.EvenFooter = footer1;
sec2.OddFooter
= footer2;
sec2.EvenFooter = footer2;
sec3.OddFooter
= footer3;
sec3.EvenFooter = footer3;
Aspose.Pdf.Generator.Text txt1 = new Aspose.Pdf.Generator.Text(dt1.Rows[0]["Tab6"].ToString());
Aspose.Pdf.Generator.Text txt2 = new Aspose.Pdf.Generator.Text(dt1.Rows[0]["Tab6"].ToString());
Aspose.Pdf.Generator.Text txt3 = new Aspose.Pdf.Generator.Text(dt1.Rows[0]["Tab6"].ToString());
Aspose.Pdf.Generator.Text txt4 = new Aspose.Pdf.Generator.Text(dt1.Rows[0]["Tab6"].ToString());
Aspose.Pdf.Generator.Text txt5 = new Aspose.Pdf.Generator.Text(dt1.Rows[0]["Tab6"].ToString());
txt1.IsHtmlTagSupported = true;
txt2.IsHtmlTagSupported = true;
txt3.IsHtmlTagSupported = true;
txt4.IsHtmlTagSupported = true;
txt5.IsHtmlTagSupported = true;
footer1.Paragraphs.Add(txt1);
footer2.Paragraphs.Add(txt2);
footer3.Paragraphs.Add(txt3);
Aspose.Pdf.Generator.Segment seg1 =
txt1.Segments.Add();
Aspose.Pdf.Generator.Segment seg2 =
txt2.Segments.Add();
Aspose.Pdf.Generator.Segment seg3 =
txt3.Segments.Add();
seg1.InlineParagraph = txt1;
seg2.InlineParagraph = txt2;
seg3.InlineParagraph = txt3;
Aspose.Pdf.Generator.Table tab1 = new Aspose.Pdf.Generator.Table();
Aspose.Pdf.Generator.Table tab2 = new Aspose.Pdf.Generator.Table();
Aspose.Pdf.Generator.Table tab3 = new Aspose.Pdf.Generator.Table();
tab1.DefaultCellTextInfo.FontSize = 10;
tab1.DefaultCellTextInfo.FontName = "Arial";
tab1.ColumnWidths = "550";
tab1.Alignment
= AlignmentType.Left;
tab2.DefaultCellTextInfo.FontSize = 10;
tab2.DefaultCellTextInfo.FontName = "Arial";
tab2.ColumnWidths = "550";
tab2.Alignment
= AlignmentType.Left;
tab3.DefaultCellTextInfo.FontSize = 10;
tab3.DefaultCellTextInfo.FontName = "Arial";
tab3.ColumnWidths = "550";
tab3.Alignment
= AlignmentType.Left;
if (dt1.Rows.Count > 0)
{
Row row1 = tab1.Rows.Add();
Cell cell1 = row1.Cells.Add();
Text text1 = newText("<p>"
+ dt1.Rows[0]["Tab1"].ToString() +"</p>");
text1.IsHtmlTagSupported = true;
text1.TextInfo.FontSize = 10;
text1.TextInfo.FontName = "Arial";
cell1.Paragraphs.Add(text1);
if (dt.Rows.Count > 0)
{
Row row6 = tab2.Rows.Add();
Cell cell6 = row6.Cells.Add();
Text text6 = newText(dt.Rows[0]["ROIData"].ToString());
text6.IsHtmlTagSupported
= true;
text6.TextInfo.FontSize = 10;
text6.TextInfo.FontName = "Arial";
cell6.Paragraphs.Add(text6);
}
Row row2 = tab2.Rows.Add();
Cell cell2 = row2.Cells.Add();
Text text2 = newText(dt1.Rows[0]["Tab2"].ToString());
text2.IsHtmlTagSupported = true;
text2.TextInfo.FontSize = 10;
text2.TextInfo.FontName = "Arial";
cell2.Paragraphs.Add(text2);
Row row3 = tab3.Rows.Add();
Cell cell3 = row3.Cells.Add();
Text text3 = newText( dt1.Rows[0]["Tab3"].ToString()
+ dt1.Rows[0]["Tab4"].ToString() +
dt1.Rows[0]["Tab5"].ToString());
text3.IsHtmlTagSupported = true;
text3.TextInfo.FontSize = 10;
text3.TextInfo.FontName = "Arial";
cell3.Paragraphs.Add(text3);
}
sec1.Paragraphs.Add(tab1);
sec2.Paragraphs.Add(tab2);
sec3.Paragraphs.Add(tab3);
sec1.AdditionalOddFooter = footer6;
sec1.AdditionalEvenFooter
= footer6;
sec2.AdditionalOddFooter = footer7;
sec2.AdditionalEvenFooter = footer7;
sec3.AdditionalOddFooter = footer8;
sec3.AdditionalEvenFooter = footer8;
Aspose.Pdf.Generator.Text txt6 = new Aspose.Pdf.Generator.Text("1");
Aspose.Pdf.Generator.Text txt7 = new Aspose.Pdf.Generator.Text("2");
Aspose.Pdf.Generator.Text txt8 = new Aspose.Pdf.Generator.Text("3");
Aspose.Pdf.Generator.Text txt9 = new Aspose.Pdf.Generator.Text("4");
Aspose.Pdf.Generator.Text txt10 = new Aspose.Pdf.Generator.Text("5");
txt6.IsHtmlTagSupported = true;
txt7.IsHtmlTagSupported = true;
txt8.IsHtmlTagSupported = true;
txt9.IsHtmlTagSupported = true;
txt10.IsHtmlTagSupported
= true;
footer6.Margin.Left
= 320;
footer7.Margin.Left = 320;
footer8.Margin.Left = 320;
pdf1.Save(Path + Convert.ToString(objEntryScreen.RefNo) + System.DateTime.Today.ToString("_dd-MMM-yyyy"));
please help me ASAP.