ng-print
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

NgPrint

Directive for printing any HTML element. For Angular 2+.

Usage

  1. Install

npm install ng-print

  1. Import into main module
import {NgxPrintModule} from 'ng-print';
 
@NgModule({
 
imports: [NgPrintModule]
 
})
export class AppModule {
}
  1. Add directive to template
<div #printThis> 
  <!--Element you want to print-->
</div>
 
<!-- 'printThis' is template reference -->
<button type="button" [elementToPrint]="printThis" ngPrint>Print table</button>

This directive create iframe on bottom of document and copy all html head into it, so the styles in your angular app are imported into iframe.

Printed element looks pretty much the same as in your app.

Created iframe is set to display:none.

After print or cancelation, it removes created iframe.

This library was generated with Angular CLI version 8.0.3.

Package Sidebar

Install

npm i ng-print

Weekly Downloads

35

Version

1.0.1

License

GPL-3.0

Unpacked Size

137 kB

Total Files

27

Last publish

Collaborators

  • burasuk