Script HTML to PDF application

I am using a Google Script application and I want to convert the contents of a div to a pdf file. I'm trying to:

function genPdf(html)
{
  var blob = Utilities.newBlob(html, "text/html", "text.html");
  var pdf = blob.getAs("application/pdf");
  DriveApp.createFile(pdf).setName("text.pdf"); 
}

The parameter 'html' of the function is passed with

$('#container').html()

The problem is that when I get the html div using the jQuery html () function, it returns me html without CSS styles and / or images.

I need to generate a PDF with exactly the same div content.

Any suggestions?

+4
source share

All Articles