1

I hvae an angular view of a pdf preview that utilizes a controller to fill the view in. I am using pdflayer then to convert the html page into a pdf. The problem however is that no matter how I try and do this the scope variable values never make it into the pdf. I am basically trying to figure out a way to capture the angular view as an html string (data already injected) so that I can pass it to pdflayer. I have tried creating a directive and used replace within the directive then collecting the DOM as a string using .HTML().

For example:

I could like this

<div id="name">{{test.name}}</div>

to become this

<div id="name">Bob Smith</div>

It inevitably however turns into this when i use $('#name').html() and then console log it

<div id="name"></div>

or

<div id="name">{{test.name}}</div>

Any help would be appreciated even if the solution is to use a different method to create the pdf. Ultimately, I need to get a angular view into a formated pdf.

Brandon
  • 45
  • 8

1 Answers1

0

Please check if below library would work for you : https://www.npmjs.com/package/angular-save-html-to-pdf

Vijay Venugopal Menon
  • 1,510
  • 1
  • 14
  • 20
  • Thanks Vijay. I checked that out a few days ago and based on the [demos](http://hearsid.github.io/angular-html-to-pdf-save/demo/index.html) from the page it doesn't look like it produces very high quality pdfs. If this is not the case let me know however I need something that will look good both on screen and in print – Brandon Aug 22 '17 at 01:25
  • I saw another question on SO and posting the link here:https://stackoverflow.com/a/34162901/6347317 .I also created a plunker with @Rani Radcliff's solution: http://plnkr.co/edit/TZQvTOPxj10pSTTSNRFI?p=preview . "pdfmake" is a popular library and there may be more options in their webpage to style the content further. Please check it out. – Vijay Venugopal Menon Aug 22 '17 at 02:00