1

I used to use this code to convert HTML code into PDF files, but since yesterday is not working anymore !

function htmlToPDF() {

  var html = "<h1>Hello world</h1>"
  var blob = Utilities.newBlob(html, "text/html", "text.html");  
  var pdf = blob.getAs(MimeType.PDF)
  DriveApp.createFile(pdf).setName("text.pdf");

}

The error I got: "Exception: Conversion from text/html to application/pdf failed. "

Can you help me please?

  • try - var pdf = blob.getAs("application/pdf"); – aNewb Aug 11 '21 at 16:33
  • I'm seeing the same thing. All working fine yesterday and now today it just comes back with the same error message. I've tried using an intermediate HTML file saved to Drive, but that doesn't work either. I already had mine as getAs('application/pdf'), so that doesn't seem to be the solution. Is there a way to see if something has changed on Google's side? – chris_huh Aug 11 '21 at 17:12

0 Answers0