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

Free Support Forum - aspose.com

Html to PDF Takes a long time

Hi -
I followed the sample below and it’s taking 20 seconds to render google to PDF. Currently running PDF version 21.4. Project is .net core 3.1.
Any thoughts?

public static void ConvertHTMLtoPDFAdvanced_WebPage()
{
    const string url = "https://www.google.com";
    const string Path = @"c:\temp\test.pdf";
     Stream mHtml = GetContentFromUrlAsStream(url);
                Aspose.Pdf.HtmlLoadOptions options = new Aspose.Pdf.HtmlLoadOptions(url)
                {
                    PageInfo = { Width = 842, Height = 1191, IsLandscape = true }
                };
                Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(mHtml,options);
               
                pdfDocument.Save(Path);
}

----- 
        private static Stream GetContentFromUrlAsStream(string url, ICredentials credentials = null)
        {
            byte[] dataBytes;
            using (WebClient webClient = new WebClient())
            {

                // Download the bytes from the location referenced by the URL.
                webClient.Proxy = null;
                WebRequest.DefaultWebProxy = null;
                webClient.UseDefaultCredentials = true;
                dataBytes = webClient.DownloadData(url);
                
            }
            MemoryStream byteStream = new MemoryStream(dataBytes);
            return byteStream;
        }

@tristianfernandez

We were able to notice the similar behavior of the API while testing the case in our environment with 21.10 version. We have logged an investigation ticket as PDFNET-50778 in our issue management system for the sake of correction. WE will further look into its details and keep you posted with the status of its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.