Free Support Forum - aspose.com

Aspose.Pdf.HtmlFragment performance issue

Hi,
I am trying to use Aspose.Pdf.HtmlFragment with Aspose.PDF DOM to create PDF where I am passing large string with HTML tags in it.
Aspose PDF performance
seems horrible and I am unable to see PDF file generated at all when HTML string reaches certain length(I guess) , I have waited more than 10 minutes in some instance.
Below is the string that I was using to test it .
PDF is generated as expected until I add text highlighted in red below.
We have use case where our strings that we want to put in PDF at times are very large with inline styles and this issue is giving us a lot of headaches.
Apose version 10.7.0.0 with License version 3.0
Aspose.Pdf.HtmlFragment verbiageContentString = new HtmlFragment(verbiageContentHtmlString);
Aspose.Pdf.Paragraphs paragraphs = curPage.Paragraphs;
paragraphs.Add(verbiageContentString);

//below is the test string used for reference
string verbiageContentHtmlString =
"

NATIONAL
\nPRICE LIST

" +
"

To speak with a Customer Service Representative:

" +

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

” +
"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +
“delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

” +

"

To speak with a Customer Service Representative:

" +

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

” +
"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +
“delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

” +

"

To speak with a Customer Service Representative:

" +

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

” +
"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +
“delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

” +

"

To speak with a Customer Service Representative:

" +

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

” +
"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +
“delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

” +

"

To speak with a Customer Service Representative:

" +

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

” +
"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +
“delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

”+

"

To speak with a Customer Service Representative:

" +

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

” +
"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +
“delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

” +

"

END

";

Hi Sam,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 10.7.0 with a valid license in VisualStudio 2010 application with target framework as .NET Framework 4.0, running over Windows 7 (x64) and I am unable to notice any issue. As per my observations, the PDF file containing whole HTML contents is being generated in 11 seconds. For your reference, I have also attached the resultant file generated over my end.

[C#]

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

//below is the test string used for reference

string verbiageContentHtmlString =

"

NATIONAL
\nPRICE LIST

" +

"

To speak with a Customer Service Representative:

" +

"

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

" +

"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +

"delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

" +

"

To speak with a Customer Service Representative:

" +

"

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

" +

"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +

"delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

" +

"

To speak with a Customer Service Representative:

" +

"

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

" +

"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +

"delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

" +

"

To speak with a Customer Service Representative:

" +

"

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

" +

"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +

"delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

" +

"

To speak with a Customer Service Representative:

" +

"

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

" +

"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +

"delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

" +

"

To speak with a Customer Service Representative:

" +

"

PAYMENT TERMS: Net 10 days from the invoice date. Prices shown are subject to change without notice.

" +

"

ORDER DEFINITION: An order is defined as an individual purchase order of at least 5,000 lbs. of product submitted for " +

"delivery to one location for shipment within 10 business days. All orders are subject to confirmation.

" +

"

END

";

Aspose.Pdf.HtmlFragment verbiageContentString = new HtmlFragment(verbiageContentHtmlString);

doc.Pages.Add();

doc.Pages[1].Paragraphs.Add(verbiageContentString);

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

Thank you for quick response. I am able to recreate it and test the issue as well from our end and concluded that the issue might have been due to static PDF name ( we were not cleaning the PDF file) . After giving dynamic file name, I was able to generate PDF several time within 18 second.
This was done with default setting. However,
When I changed the page orientation landscape to True (we are determining it dynamically based on # of columns in table) I am still getting issue where PDF is not saved within accepted range of time.
Tested in VS2013 .Net 4.5.1 with Aspose 10.7.0

Hi Sam,


I have again tested the scenario using latest release of Aspose.Pdf for .NET 10.8.0 where I have used doc.PageInfo.IsLandscape = true; in code snippet and as per my observations, the PDF document is being generated in 7.5 seconds. Can you please share complete code snippet or sample application which can help us in reproducing the issue in our environment.