marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 543 forks source link

PDF conversion of a simple AngularJS application #74

Open mah01 opened 9 years ago

mah01 commented 9 years ago

Hey,

I am trying to convert a simple AngularJS application to PDF. However, I do not see angular generated content inside the converted pdf. Am I missing something obvious?

I am attaching the html screen how it should look like. "Right after body" is the <p> tag inside the index.html right after <body> and "right before body end" is the same, but just before </body>. All other text is "generated" by angular in the template.

Rendered html when I see it in the browser:

screen shot 2015-09-26 at 14 40 54

Generated PDF (for some reason I am not able to attach it here): https://dl.dropboxusercontent.com/u/3585277/generated_file.pdf

html: https://dl.dropboxusercontent.com/u/3585277/dist.zip

laurence-myers commented 8 years ago

How are you getting the HTML and passing it to html-pdf?

I think you would need to render the HTML on the client (or maybe PhantomJS), then pass that rendered HTML back to the server, to be passed to html-pdf. I would recommend getting the rendered HTML by doing something like "document.documentElement.outerHTML". This ensures you get the HTML as you see it in your browser, after all AngularJS code has run.

jmorrisIII commented 8 years ago

@mah01 Did you get this working?

mah01 commented 8 years ago

No, I have not tried

marcbachmann commented 8 years ago

to get this working, we'll need #133