title: SelectPDF for .Net :DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found
body: <p>I am trying to generate pdf from html. I am using <a href="https://selectpdf.com/demo-mvc/ConvertHtmlCodeToPdf" rel="nofollow noreferrer">SelectPdf for .Net</a>.
  When I try to generate pdf, I get this error: </p>
  
  <blockquote>
    <p>DllNotFoundException: Unable to load DLL 'libgdiplus': The specified
    module could not be found.</p>
  </blockquote>
  
  <p>My primary Guide is <a href="https://selectpdf.com/demo-mvc/ConvertHtmlCodeToPdf" rel="nofollow noreferrer">This Documentation on their official website</a></p>
  
  <p><a href="https://i.stack.imgur.com/2aCSa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2aCSa.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/WdSPd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WdSPd.png" alt="enter image description here"></a>
  SettingsController.cs</p>
  
  <pre><code>[Route ("settings/aaa")]
      public IActionResult GeneratePdf () {
  
          return View ();
      }
  
      [HttpPost]
      [Route ("settings/aaa")]
      public IActionResult GeneratePdf (IFormCollection collection) {
          // read parameters from the webpage
          string htmlString = collection["TxtHtmlCode"];
          string baseUrl = collection["TxtBaseUrl"];
  
          int webPageWidth = 1024;
  
  
          int webPageHeight = 1280;
  
          // instantiate a html to pdf converter object
          HtmlToPdf converter = new HtmlToPdf ();
  
          converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait;;
          converter.Options.WebPageWidth = webPageWidth;
          converter.Options.WebPageHeight = webPageHeight;
  
          // create a new pdf document converting an url
          PdfDocument doc = converter.ConvertHtmlString (htmlString, baseUrl);
  
          // save pdf document
          byte[] pdf = doc.Save ();
  
          // close pdf document
          doc.Close ();
          // return resulted pdf document
          FileResult fileResult = new FileContentResult (pdf, "application/pdf");
          fileResult.FileDownloadName = "Document.pdf";
          return fileResult;
  
      }
  </code></pre>
  
  <p>GeneratePdf.cshtml</p>
  
  <pre><code>&lt;div&gt;
      &lt;form method="post" asp-controller="Settings" asp-action="GeneratePdf"&gt;
          &lt;input value="stuff" name="TxtHtmlCode"/&gt;
          &lt;input value="" name="TxtBaseUrl"/&gt;
          &lt;input type="submit" value="submit"&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My goal is to make SelectPdf generate pdf from "TxtHtmlCode" input.</p>