An open API service indexing awesome lists of open source software.

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

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

```