Skip to main content

Posts

Showing posts with the label Print PDF

The ngx-print Library To Print HTML To PDF In Angular Application

In this article, we will understand the process to generate the HTML to PDF using 'ngx-print' library in Angular. An Overview On ngx-print Library: This library works based on directives. These directives make the printing HTML to PDF very easily with smooth transitions. The key terms of this library are: NgxPrintModule ngxPrint(Directive) printSectionId(Input Property) printTitle(Input Property) printStyle(Input Property) useExistingCss(Input Property) styleSheetFile(Input Property) Create A Sample Angular Application: Let's create a sample angular application where we are going to implement logic to use 'ngx-print' library. Command To Install Angular CLI:(If not installed on your system previously) npm install -g @angular/cli Angular CLI Command To Create Angular App: ng new your_project_name Command To Run App: ng serve Install Print Npm Package: Command To Install Print Package npm install ngx-print After installing the npm package reference will be