I have a custom Google Script with a simple logic: it looks up parts from the spreadsheet and builds an in-memory HTML string, then I call the following code to produce the PDF.
var blob = Utilities.newBlob(html_body, 'text/html').getAs('application/pdf').setName(pdf_name);
var newDoc = DriveApp.createFile(blob);
var pdf_url = newDoc.getUrl();
Surprisingly for the same content, it sometimes works and randomly returns the error:
Conversion from text/html to application/pdf failed.
I see this happening most for larger files, so I am probably hitting some quota limitations.
But as per https://developers.google.com/apps-script/guides/services/quotas#current_limitations hitting any limitations should raise a relevant message.
Also documentation around https://developers.google.com/apps-script/reference/base/blob#getAs(String) does not state anything.
Any ideas?
Thank you!