title: How to use wkhtmltopdf and Azure Functions together to convert HTML to IMAGE?
body: <p>I have an AF to which I pass a parameter with a website and the function creates a blob with a converted html to image. How exactly to do this with wkhtmltopdf, as I understand that some .exe needs to be uploaded somewhere near my Azure Function, but do not fully understand the whole procedure. I downloaded the wkhtmltopdf installer from the website and then installed it on my Windows machine. What do I need to do on Azure? Any tutorials or lessons?</p>
  
  <p>I am using this: <a href="https://github.com/mrdaghestani/HtmlPI" rel="nofollow noreferrer">https://github.com/mrdaghestani/HtmlPI</a>
  but do not understand this part:</p>
  
  <blockquote>
    <p>First you have to install wkhtmltopdf on application server (your developing system or client's systems)</p>
  </blockquote>
  
  <p>How to install this on Azure so my Azure Function to work there?</p>
  
  <pre><code>[FunctionName("htmlToImage")]
  public static async Task&lt;HttpResponseMessage&gt; 
  Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = 
  null)]HttpRequest req, TraceWriter log)
  {
  string url = req.Query["url"];
  
  byte[] EncodedData = Convert.FromBase64String(url);
  string DecodedURL = Encoding.UTF8.GetString(EncodedData);
  
  string requestBody = new StreamReader(req.Body).ReadToEnd();
  dynamic data = JsonConvert.DeserializeObject(requestBody);
  DecodedURL = DecodedURL ?? data?.name;
  
  HtmlConverter htmlConverter = new HtmlConverter();
  var filePath = htmlConverter.Convert(new GenerateSettings { Url = DecodedURL, OutputType = OutputType.Image });
  
  //string BlobName = "myblob1";
  //string ImageURL = await CreateBlob($"{BlobName}.png", (byte[])..., log);
  
  var Result = new HttpResponseMessage(HttpStatusCode.OK);
  
  //
  // JSON
  //
  var oJSON = new { url = ImageURL, hash = BlobName };
  var jsonToReturn = JsonConvert.SerializeObject(oJSON);
  
  Result.Content = new StringContent(jsonToReturn);
  Result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
  
  return Result;
  }
  </code></pre>