1

I've been trying to find a solution to getting an HTML element to print in my MEAN app. I've checked ng-print, angular-print, angular-save-html-to-pdf and more, but these all seem to have been developed for Angularjs. Does anyone have a solution for printing in the newest version of angular?

or failing that, how can I use something like angular-print with angular 2 and above?

for clarification: i'd ideally import the module/directive into app.module.ts, then mark the elements and button i'd like to use with printing in my html file. I also assume i may need to add something to the component linking to the html file. The html would look like:

<button print-directive>Print</button>
<div print-id="printThisElement">
    <p>content</p>
</div>

or

<button (click)="printfunction();">Print</button>
<div print-id="printThisElement">
    <p>content</p>
</div>

1 Answer 1

2

Found a NPM package called essence-ng2-print that was compatible with angular and wasn't too much effort to translate. Some parts are not apparent at first but after some digging I was able to get it to work. If anyone ever reads this and finds they have the same problem, but cannot get essence to work, I will post the steps i took here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.