https://github.com/pavankjadda/ngx-printx
Angular 9+ print HTML
https://github.com/pavankjadda/ngx-printx
angular
Last synced: about 2 months ago
JSON representation
Angular 9+ print HTML
- Host: GitHub
- URL: https://github.com/pavankjadda/ngx-printx
- Owner: pavankjadda
- License: mit
- Created: 2020-04-03T17:56:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-10T05:43:01.000Z (about 3 years ago)
- Last Synced: 2025-01-07T22:36:53.950Z (over 1 year ago)
- Topics: angular
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/ngx-printx
- Size: 2.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ngx-printx : *plug n' play Angular (2++) directive to print your stuff*
This directive makes printing your HTML sections smooth and easy in your Angular application. It is intended to use with the new Angular -2+
## Setup
**1-** In your root application folder run:
```bash
$ npm install ngx-printx
```
**2-** Once `ngx-printx` is installed, you need to import the main module `NgxPrintModule` :
```js
import {NgxPrintModule} from 'ngx-printx';
@NgModule({
...
imports: [NgxPrintModule, ...],
...
})
export class YourAppModule {
}
```
**3-** Then plug n' play with it:
- Assuming you want to print the following HTML section:
```html
print
```
- Now, what you have to do is tagging your *wanted-to-print* section by an `id` attribute, then link that `id` to a directive parameter in your button :
```html
print
```
## Optional properties
- You want a customized title for your printing window ? you have the choice by adding a new attribute to your print button `printTitle`:
```html
print
```
- Also, would you like to customize the printing window style sheet (CSS) ? Hence you can do so by adding infinite styles to another attribute called `printStyle`:
```html
print
```
Here some simple styles were added to every `h1` & `h2` tags within the `div` where `print-section` is tagged to its `id` attribute.
- If you would like to use your existing CSS with media print you can add the `useExistingCss` attribute:
```html
print
```
- If you want to customize the printing window style sheet (CSS) by importing the css provided in assets/css use `styleSheetFile`:
```html
print
```