title: How to wait until form is fully loaded HTML to PDF In MVC
body: <p>I am using epfhtmltopdf dll for converting HTML to pdf wherein the page is getting rendered but we have a graph on the page which is called by angular js after getting Id of DIV element but not getting reflected in the pdf because page gets render but chart comes after 2 seconds. I have also used the property</p>
  
  <p>pdfConverter.ConversionDelay = 20; </p>
  
  <p>but still, it is taking time but no luck
  Please help
  Here is the given code:</p>
  
  <pre><code> public void DownloadPDF(int? ReportLogId, int? StockID)
      {
          string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/";
          string urlToConvert = baseUrl + "CompanyResearch/Index?ReportLogId=" + ReportLogId + "&amp;StockID=" + StockID;
  
          PdfConverter pdfConverter = new PdfConverter();
  
          pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
          pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;
          pdfConverter.PdfDocumentOptions.ShowHeader = true;
          pdfConverter.PdfDocumentOptions.ShowFooter = true;
          pdfConverter.PdfDocumentOptions.LeftMargin = 5;
          pdfConverter.PdfDocumentOptions.RightMargin = 5;
          pdfConverter.PdfDocumentOptions.TopMargin = 5;
          pdfConverter.PdfDocumentOptions.BottomMargin = 5;
          pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = true;
          pdfConverter.RenderOnTimeout = true;
  
          pdfConverter.PdfDocumentOptions.ShowHeader = false;
          //pdfConverter.PdfHeaderOptions.HeaderText = "Sample header: " + TxtURL.Text;
          //pdfConverter.PdfHeaderOptions.HeaderTextColor = Color.Blue;
          //pdfConverter.PdfHeaderOptions.HeaderDescriptionText = string.Empty;
          //pdfConverter.PdfHeaderOptions.DrawHeaderLine = false;
  
          pdfConverter.PdfFooterOptions.FooterText = "Sample footer: " + urlToConvert +
          ". You can change color, font and other options";
          pdfConverter.PdfFooterOptions.FooterTextColor = Color.Blue;
          pdfConverter.PdfFooterOptions.DrawFooterLine = false;
          pdfConverter.PdfFooterOptions.PageNumberText = "Page";
          pdfConverter.PdfFooterOptions.ShowPageNumber = true;
          pdfConverter.ConversionDelay = 20;
  
  
          //pdfConverter.LicenseKey = "put your serial number here";
          byte[] downloadBytes = pdfConverter.GetPdfBytesFromUrl(urlToConvert);
  
  
  
  
          // byte[] Bytes = pdfConverter.GetPdfFromUrlBytes(urlToConvert);
  
  
  
          System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
          response.Clear();
          response.AddHeader("Content-Type", "binary/octet-stream");
          response.AddHeader("Content-Disposition",
          "attachment; filename=" + "DownloadedPDF.pdf" + "; size=" + downloadBytes.Length.ToString());
          response.Flush();
          response.BinaryWrite(downloadBytes);
          response.Flush();
          response.End();
  
  
      }
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Ritesh</p>