title: CSS is lost when converting HTML to PDF in Google Apps Script
body: <p>I have HTML files located in a Google Drive folder. I am trying to get the files, read content, convert to PDF and then save to the same folder.</p>
  
  <p>The whole flow works fine, but most of the HTML formatting is lost (like fonts etc). Is there a way to convert HTML to PDF the same way as it looks in HTML?</p>
  
  <p>Here the code:</p>
  
  <pre><code>function myFunction() {
  
    var folder = DriveApp.getFolderById("0B9EI2E_9Cj9rT1JmVk5ESnhVbjA");
    var contents = folder.getFilesByType(MimeType.HTML);
  
    while (contents.hasNext()) {
     var file = contents.next();
     var fileName = file.getName();
  
     var rawFileName = fileName.substring(0,fileName.indexOf("."));
     var newFileName = rawFileName+".pdf";
  
     var htmlBody = HtmlService.createHtmlOutput(file).getContent();
  
     var blob = Utilities.newBlob(htmlBody, 'text/html').getAs('application/pdf').setName(newFileName);
  
     folder.createFile(blob);
   }
  }
  </code></pre>