Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

HTML to PDF - Initial Slow Saving

$
0
0

Hi,

We are encountering an issue where the initial saving of PDF (using HTML conversion support) is taking significantly longer than subsequent saves.  This performance issues appears to be process-specific.  Is there a way to pre-load the library so that the initial call doesn't have to be so lengthy?  Ideally, this would be a one-time call when the application starts up - any subsequent saves would be fast, and consistent, no matter if called from the same process or different processes.

Here is an example to illustrate:

            DateTime start1 = DateTime.Now;
            var doc = new Aspose.Pdf.Generator.Pdf();
            Aspose.Pdf.Generator.Section section = doc.Sections.Add();
            Aspose.Pdf.Generator.Text text = new Aspose.Pdf.Generator.Text(section, "<html><body>Hello world!!!</body></html>");
            text.IsHtmlTagSupported = true;
            text.IsHtml5Supported = true;
            section.Paragraphs.Add(text);
            doc.Save("c:\\Temp\\Test.pdf");
            DateTime end1 = DateTime.Now;

            Console.WriteLine("First Time Seconds: " + end1.Subtract(start1).Seconds);

            // First Time Seconds: 40 SECONDS

            DateTime start2 = DateTime.Now;
            doc = new Aspose.Pdf.Generator.Pdf();
            section = doc.Sections.Add();
            text = new Aspose.Pdf.Generator.Text(section, "<html><body>Hello world!!!</body></html>");
            text.IsHtmlTagSupported = true;
            text.IsHtml5Supported = true;
            section.Paragraphs.Add(text);
            doc.Save("c:\\Temp\\Test.pdf");
            DateTime end2 = DateTime.Now;

            Console.WriteLine("Second Time Seconds: " + end2.Subtract(start2).Seconds);

            // Second Time Seconds: 0 SECONDS

            Console.ReadLine();

 


Viewing all articles
Browse latest Browse all 3131

Trending Articles