AngularPrint
An Angular module that allows users to selectively print elements, as well as provides optimizations for printing. By default, printing margins are minimized.
Installation
- make sure bower is installed
- navigate to the root directory of your project and execute the command "bower install angular-print"
- import module to your Angular app using the name "AngularPrint"
Using AngularPrint
printSection
- Directive type: Attribute
- Makes element and its children visible for printing
```html
```
printOnly
- Directive type: Attribute
- Makes element and its children only visible for printing
```html
I'll print, but until then nobody wants me
Me, too!
Me, too! Except that people still want to look at me in the meantime...
```
printHide
- Directive type: Attribute
- Makes element invisible during printing, but it is replaced by blank space
```html
I'll print, but those bozos upstairs are still taking up space
```
printRemove
- Directive type: Attribute
- Makes element invisible during printing
```html
I'll print, and those bozos upstairs will finally stop making such a ruckus
```
printIf
- Directive type: Attribute
- Toggles print-visibility based on expression
```html
```
printBtn
- Directive type: Attribute
- Adds onClick callback to element that will trigger printing
```html
Doesn't matter where you put me
I will make anything cause a print
to happen if you click me
```
printLandscape
- Directive type: Attribute
- Will cause printing to be landscape instead of portrait
```html
Doesn't matter where you put me
I will cause any print
to be landscape
```
printAvoidBreak
- Directive type: Attribute
- Prevents page breaks on element
```html
This element won't get split by page breaks
```
printTable
- Directive type: Attribute
- Optimizes table for printing. This includes keeping 'td' cell content from being cut-off by page breaks.
- Must be passed an array scope object representing the data presented by the table
- Column headers will persist between pages only if the `````` and `````` tags are used correctly
This example shows adjustments to an already-visible table in order to tailor it for printing
```html
Unwanted field | Name | Address | Phone |
{{person.unwantedInfo}} | {{person.name}} | {{person.address}} | {{person.phone}} |
```
This example shows a table made to only be visible during printing
```html
Name | Address | Phone |
{{person.name}} | {{person.address}} | {{person.phone}} |
```