Coder Social home page Coder Social logo

selemxmn / ngx-print Goto Github PK

View Code? Open in Web Editor NEW
158.0 11.0 57.0 857 KB

:printer: A plug n' play Angular (2++) library to print your stuff

License: MIT License

JavaScript 5.05% TypeScript 94.95%
angular angular-2 angular4 angular5 angular6 npm printing print library dependency

ngx-print's Introduction

Coverage Status

ngx-print : 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 inspired from the old AngularJS ngPrint directive, thus it is intendend to be used with the new Angular -2/4/5/6/7-... Enjoy ! contributions are so welcomed :)

Dependencies

ngx-print Angular
1.2.1 7.0.0 - 14.1.0
1.3.x 15.0.0
1.4.x 16.0.0
1.5.x 17.0.0

Setup

1- In your root application folder run:

$ npm install ngx-print

2- Once ngx-print is installed, you need to import the main module NgxPrintModule :

import {NgxPrintModule} from 'ngx-print';

@NgModule({
...
imports: [NgxPrintModule, ...],
...
})
export class YourAppModule {
}

3- Then plug n' play with it:

  • Assuming you want to print the following HTML section:
<div>
  <!--Your html stuff that you want to print-->
</div>
<button>print</button> <!--Your relevant print button-->
  • 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 :
 <!--
   1)- Add an ID here
 -->
<div id="print-section"> 
  <!--Your html stuff that you want to print-->
</div>

 <!--
   2)- Add the directive name in your button (ngxPrint),
   3)- Affect your ID to printSectionId
 -->
<button printSectionId="print-section" ngxPrint>print</button> 

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:
<div  id="print-section">

<!-- ... -->

</div>

<button  
	printTitle="MyTitle"  
	printSectionId="print-section"  
	ngxPrint>print</button>
  • 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:
<div  id="print-section">

<!-- ... -->

</div>

<button
	[printStyle]="{h1 : {'color': 'red'}, h2 : {'border': 'solid 1px'}}"
	printSectionId="print-section"
	ngxPrint>print</button>

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:
<div  id="print-section">

<!-- ... -->

</div>

<button
  [useExistingCss]="true"
	printSectionId="print-section"
	ngxPrint>print</button>
  • If you want to customize the printing window style sheet (CSS) by importing the css provided in assets/css use styleSheetFile:
<div  id="print-section">

<!-- ... -->

</div>

<button
  styleSheetFile="assets/css/custom1.css,assets/css/custom2.css"
  printSectionId="print-section"
  ngxPrint>print</button>
  • If you would like to show a preview without a print dialog use previewOnly:
<div  id="print-section">

<!-- ... -->

</div>

<button
  [previewOnly]="true"
	printSectionId="print-section"
	ngxPrint>print</button>
  • Some print operations open a second dialog, and automatically closing the popup window happens before the second dialog opens. Set closeWindow to false to handle print operations that open a second dialog, like "Microsoft Print to PDF", or "Print using system dialog...":
<div  id="print-section">

<!-- ... -->

</div>

<button
	[closeWindow]="false"
	printSectionId="print-section"
	ngxPrint>print</button>
  • Set bodyClass to whatever class values are needed for some of your css rules that expect an ancestor to have a certain class. For example, a theme selector:
<div  id="print-section">

<!-- ... -->

</div>

<button
	[bodyClass]="theme-dark"
	printSectionId="print-section"
	ngxPrint>print</button>
  • To print in a new tab rather than a new window set the property openNewTab to true. By default openNewTab is false and ngxPrint will open a new print window.
<button
	[openNewTab]="true"
	ngxPrint>print</button>

Using NgxPrint as a service (v1.5+)

Inject the NgxPrintService in the constructor of your component or service:

constructor(private printService: NgxPrintService) { }

Printing a Section

import { PrintOptions } from './path-to-your/print-options.model';

printMe() {
  const customPrintOptions: PrintOptions = new PrintOptions({
      printSectionId: 'print-section',
      // Add any other print options as needed
  });
  this.printService.print(customPrintOptions)
}

Print Options Object

The print options object allows you to specify how the print job should be handled. All of which have default values that you can optionally override, although printSectionId is required. It contains the following properties:

  printSectionId: string = null;
  printTitle: string = null;
  useExistingCss: boolean = false;
  bodyClass: string = '';
  openNewTab: boolean = false;
  previewOnly: boolean = false;
  closeWindow: boolean = true;
  printDelay: number = 0;

Setting PrintStyles or StyleSheets

// Optional property for css as a key-value pair
this.printService.printStyle = styleSheet;

// Optional property for a css file location
this.printService.styleSheetFile = fileLocation;

Contributors ๐Ÿฅ‡

Huge thanks to: deeplotia , Ben L , Gavyn McKenzie , silenceway, Muhammad Ahsan Ayaz, Core121 and to all ngx-print users

Donation

Did this project help you reducing time? I won't say no to a cup of coffee ๐Ÿต :)

paypal

ngx-print's People

Contributors

ahsanayaz avatar anzap avatar broem avatar ciege avatar core121 avatar davemecha avatar dependabot[bot] avatar gurutechstu avatar markadamsgarmin avatar schattenjeager avatar selemxmn avatar tomassurek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngx-print's Issues

Pagination not applied if printable content is a child-component

Describe the bug
No pagination applied in case that the printable area is a child-component, so just the first page is showed to be printed.
If I'm adding the button inside of the child-component, the [useExistingCss]="true" is not applied.

image
Using Chrome 81.0.4044.113 and Firefox 70.0.1

Thank you!

Can't print value of <input> tag

My code:
<input type="text" [(ngModel)]="data.value" [ngModelOptions]="{standalone: true}">
but i can't see value of input in print screen.
What I wrong?

ngx-print does not take color to the print screen ( when you add a background-color to HTML/CSS) it does not show on the printed sheet

Describe the bug
background-color does not pull through to the printed sheet

To Reproduce
add a background color to your CSS file, or even inline on your HTML

Expected behavior
Background color is displayed when you want to print ( example background color is blue)

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10.
  • Browser chrome.
  • Version Version 74.0.3729.169 (Official Build) (64-bit)

Additional context
Add any other context about the problem here.

Can't load image in html

I am trying to print my html section. It does not get correctly to given path.

So it doesn't print image.

<img src="./assets/img/logo"/>

When I set like this it can't load logo image.

ngx-print not supported in angular library build

Describe the bug
AOT fails on angular 7 library build but not in the main application build.

BUILD ERROR
projects\demo\src\lib\demo.component.ts.DemoComponent.html(5,5): : Directive NgxPrintDirective, Expected 0 arguments, but got 1.

Error: projects\demo\src\lib\demo.component.ts.DemoComponent.html(5,5): : Directive NgxPrintDirective, Expected 0 arguments, but got 1.
at Object. (C:\dev\printing-module\node_modules\ng-packagr\lib\ngc\compile-source-files.js:65:19)
at Generator.next ()
at fulfilled (C:\dev\printing-module\node_modules\ng-packagr\lib\ngc\compile-source-files.js:4:58)

projects\demo\src\lib\demo.component.ts.DemoComponent.html(5,5): : Directive NgxPrintDirective, Expected 0 arguments, but got 1.

Error: projects\demo\src\lib\demo.component.ts.DemoComponent.html(5,5): : Directive NgxPrintDirective, Expected 0 arguments, but got 1.
at Object. (C:\dev\printing-module\node_modules\ng-packagr\lib\ngc\compile-source-files.js:65:19)
at Generator.next ()
at fulfilled (C:\dev\printing-module\node_modules\ng-packagr\lib\ngc\compile-source-files.js:4:58)

To Reproduce
Steps to reproduce the behaviour.

  1. Create a new angular 7 application.
  2. ng new library print-lib
  3. Use your example code as a component library code

Expected behaviour
No build error and allow the code to be used inside an angular library

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 1.1.4

Additional context
library component example

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'lib-demo',
  template: `
    <div id="print-section">
      <!-- ... -->
    </div>
    <button
      [printStyle]="{ h1: { color: 'red' }, h2: { border: 'solid 1px' } }"
      printSectionId="print-section"
      ngxPrint
    >
      print
    </button>
  `,
  styles: []
})
export class DemoComponent implements OnInit {
  constructor() {}

  ngOnInit() {}
}

Window title

Print dialog will open in an additionally window which has the title of name from package.json which means you can't have an uppercase first letter. Is it possible to just set a custom name?

directly send to printer

Is this possible to send print job directly to a specific printer ?
i want to print directly without showing the printer choose page. i am finding this kind of functionality with angular so is this possible with this ?

IE 11 print popup window extremely small

Describe the bug
Whenever you invoke ngx-print in IE 11, the window pops up VERY small, you cannot even modify the dimensions.

To Reproduce
Invoking ngx-print on any element using IE 11

Expected behavior
I expect a reasonably sized print preview pop up upon invoking the library

Screenshots
Screen Shot 2020-05-13 at 5 03 29 PM

Desktop (please complete the following information):

  • OS: Wndows 10
  • Browser Internet Explorer 11
  • Version Latest

Additional context
Add any other context about the problem here.

Doesn't print html as it is

I want to print the following HTML (pic 1) but getting the output as pic 2

Screenshots

HTML:
Screenshot from 2019-06-04 14-53-58

Output:

Screenshot from 2019-06-04 14-54-19

Version
5.6.0

Not able use multiple styles

Describe the bug
If we give multiple styles to an element, no style is applied to the element.

To Reproduce
Add one more style to h1 tag in [printStyle]. e.g. [printStyle]="{h1 : {'color': 'red', 'border': '1px solid'}, h2 : {'border': 'solid 1px'}}"

Expected behavior
[printStyle] should accept multiple styles for an element.

Screenshots
stackblitz

Desktop (please complete the following information):

  • Windows 10
  • chrome V71, Firefox V63

remove date from header

I want to remove date from header. Can you please guide me how i can remove the date from header.

THANK YOU.

[useExistingCss] doesn't seem to work on Safari

Describe the bug
On safari, I was getting a blank page when printing. It started working again after I removed the [useExistingCss]="true", but then it wasn't styled. I have global styles and component level styles, and this seemed to work on

To Reproduce
add [useExistingCss]="true"
use safari

I tried to do the above on this project https://stackblitz.com/edit/demo-ngx-print?file=src%2Fapp%2Fapp.component.html

  1. update ngx-print
  2. add [useExistingCss]="true"
  3. Attempt to print
    Safari behaves weirdly.

Expected behavior
New tab and can print as normal

Screenshots

Desktop (please complete the following information):

  • OS: MacOS Mojave 10.14.3
  • Browser: Safari 12.0.3
  • Version: ngx 1.2.0-beta.2

I think the issue most likely has something to do with the <body onload=window.print();window.close()>, it seems to attempt to print before all the css is loaded

Print without print dialoge box?

Is this possible to send print job directly to a specific printer ?
i want to print directly without showing the printer choose page. i am finding this kind of functionality with angular so is this possible with this ?

Font Awesome icon not getting printed with ngx-print

Font awesome icon is not reflecting in the print preview with ngx-print. When doing Ctrl+P, it is getting reflected properly in the Print preview section.

Original Screen

Original page

Print with Ctrl+P

Print manually

Print with ngx-print

print with ngx print

Unable to print in landscape mode

Describe the bug
Unable to print the report in landscape mode with the following CSS

/* print only styling */
@media print {
 @page  {
   size: a3 landscape;
 }
}

To Reproduce
Add the above CSS to Angular component SCSS/CSS to print the report in A3 landscape mode

Expected behavior
Prints report in A3 landscape format

Desktop (please complete the following information):

  • OS: macOS 10.15.3
  • Browser: Chrome
  • Version: 80

useExistingCss only works in develop mode

Describe the bug
After production build the application with Angular CLI, the 'useExistingCSS' directive does not take effect. the SPA is developed with angular 7.

Expected behavior
Production build apps performs the same as is in developing mode.

Screenshots
-- developing mode:
image
-- production build:
image

Print Dialog Not Appearing for IE

Printing works as expected in Chrome and Firefox, but when the same page is accessed using IE 11 (Version: 11.3143.14393.0), clicking the Print button causes a preview window to appear (which looks as expected) but the Print dialog is not appearing.

To Reproduce
Attempt to print content using IE 11 browser.

Expected behavior
Expect to see a print dialogue window where user can select printer etc.

Screenshot
No Print Dialogue Bug - Internet Explorer

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: IE
  • Version: 11.3143.14393.0

print is preprended with words Undefined Undefined

Output of print shows as: undefined undefined Hello World

Code snippet:

Hello World
Print

Running Angular 7 app in google Chrome Version 74.0.3729.131 (Official Build) (64-bit)
on Windows 7

I got this same behaviour in my app so I simplified it down to the basic snippet. Full code of the component I am trying to use this in is:

Ingredients

NOAH: {{ recipe.NOAH }} {{ recipe.settings.Units }} KOH: {{ recipe.KOH }} {{ recipe.settings.Units }} Water: {{ recipe.water }} {{ recipe.settings.Units }} Fragrance: {{ recipe.fragrance }} {{ recipe.settings.Units }} {{ oil.Name }}: {{ oil.Weight }} {{ recipe.settings.Units }}
*97% purity NOAH *90% purity KOAH
Hello World
Print

Print PDF embed

Hi.

Im trying to print a PDF file in tag but the page is in blank.

<div class="modal-body" >
      <embed id="printable" [src]="url | safe" frameborder="0" width="100%" height="500px">
  </div>
  <div class="modal-footer">
    <button printSectionId="printable" ngxPrint>Imprimir</button>
  </div>

styles are not being set appropriately

I am trying to set styles to component as is described in the documentation but these are not taken by the plugin. It seems like only take the first style of each element or styles with only one property (i.e h1{font-weight: bold }).

To Reproduce

  1. Create a new angular 7 application.
  2. ng new library print-lib
  3. set styles with several rules on them.
    <button type="button" class="btn btn-primary" [printStyle]="{ div: {'width': '2.025in', 'height': '.875in', 'padding':'.125in .3in 0', 'margin-right':'.125in', 'display':'inline-block'}, label: {'display':'block', 'white-space': 'nowrap', 'overflow':'hidden', 'font-size':'5px'}, img: {'max-width':'40%'}}" printSectionId="print-section" ngxPrint>show modal</button>

Expected behavior
Take and apply all the styles appropriately.

  • Mac OS High Sierra
  • Chrome
  • Version: 1.1.4

Can't print in a 2nd component

Describe the bug
I have some components in the application. I implement ngx-print in the toplevel module, at the customers' module; the ngx-print works fine, so when I try to use in a second component I have nothing, and when I try to use the same style used in the first component I get the following error:
ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'printStyle' since it isn't a known property of 'button'. ("n mat-raised-button color="success" printTitle="Pedido" printSectionId="print-section" ngxPrint [ERROR ->][printStyle]="{span : {'font-family': 'sans-serif'}, h3 : {'border': 'solid 1px'} }" >Imprimir</button>"): ng:///HistoricoModule/DetalheHistoricoComponent.html@148:4

The code to both components are:
<button mat-raised-button color="success" printTitle="MyTitle" printSectionId="print-section" ngxPrint [printStyle]="{span : {'font-family': 'sans-serif'}, h3 : {'border': 'solid 1px'} }" >Imprimir</button>

When I remove printStyle option, I get no erros but I get no print.

Desktop (please complete the following information):

  • OS: MacOS 10.13
  • Browser: chrome
  • Version 72.0.3626.121

Image is not getting printed with ngx-print.

Image is not getting printed with ngx-print.
However the image is visible on the screen , but not visible in the print preview section.

<button  type="button" printTitle="PrintVoucher" [useExistingCss]="true" 
                                        printSectionId="printVoucher" ngxPrint>
                                        Print </button>
<div row id="printVoucher" >
 <img  src="assets/images/logo.png">
</div>

Number Of Rows Per Page

Is your feature request related to a problem? Please describe.
Yes. I want to define the number of rows per page.

Describe the solution you'd like
We want number of specified rows per page so that it will be align in page.

Describe alternatives you've considered

Additional context

Print using keyup.enter

Is your feature request related to a problem? Please describe.
I am creating a POS system, where I want to minimise user switching between keyboard and mouse. When I want to print, using ngxPrint, I can only use print button. I tried to move the codes in the buttons into text input, but no success.

Describe the solution you'd like
It will be nice if we can print using keyup.enter

Use ngxPrint with anchor tag?

Is your feature request related to a problem? Please describe.
I attempted to use ngxPrint with an <a> tag but nothing happened when I clicked it. Using a <button> instead allowed it to work.

Describe the solution you'd like
I would like to use an <a> tag rather than a <button> for stylistic reasons.

Callback events to trigger either window closed or print completes

Html->

<button class="btn btn-primary" tooltip="Print" style="margin-left: 12px;" [useExistingCss]="true"
[styleSheetFile]="stylesURL" printSectionId="sectiontoprint" ngxPrint>print
Print Order

I were using this above snippet for html print with this feature ngx-print, but i want to request and to know how to make sense(trigger) either print is complete or cancel pressed. Could you please add this ability.
Thanks!

Add styles by passing the css file names to enable multple styles

Is your feature request related to a problem? Please describe.
It would be better if we could load the css files in the print window html. So that if there are multple styles that needs to be applied than no need to pass those cumbersome css through [printStyle] attribute.

Describe the solution you'd like
Just pass the css names to something like [styleSheetFile] tag and append it to tag of pring window screen.

Input values are not getting printed.

Form controls values are not getting displayed in print screen
For example, if I have an element like below.
<input name="shipTo" #shipTo="ngModel" [(ngModel)]="invoiceService.formDate.shipTo" type="text" class="form-control" placeholder="Ship To" [disabled]="invoiceService.formDate.paymentStatus=='Paid'">

It is not getting displayed.

Can anyone look into this and let me know as soon as possible.
Web page as shown in the screen shot.
image

Print Screen as shown below.
image

Ngx Print not working with input values - ngModel Values

I have a html form and many input values which are using ngModel for to and fro communication. But when im using ngx-print in this form, all the input values are getting empty and showing a preview to download as pdf. Also tried the same in stackblitz. Please check the image
issue

print window opens before page is fully loaded

Describe the bug
Print window opens before page is fully loaded, so there are missing content such as styles and even text. It was working as expected until I started adding a bit of styling to the page. This issue occurred in Chrome. Please see screen shot below, there should be an image in the top right corner as well missing text in the table. The page would sometimes load and print as expected.

To Reproduce
set useExistingCss="true" on directive. Add plenty of borders with colors on a bootstrap grid layout. I am targeting a component which is part of a heavily styled single page app. There was no bundling or minification at the time, this is in Dev environment.

Expected behavior
To see a fully loaded page before the print window is opened.

Screenshots
ngx-print

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: chrome
  • Version [Version 77.0.3865.120 (Official Build) (64-bit)]

Additional context
Using Angular 8, with bootstrap and material components.
I believe that I have found a solution, I will submit a PR for your review.
Using the latest version beta release from NPM

Preview window size is very small in IE and Firefox

When I click the print button in IE11 or Firefox, the size of the Preview window is very small and the content is unreadable.

Since it is not possible to change the style using @media print I do not know how to set the size of the preview window:
image

Html table display

Hi, nice work! I can`t display an html table in the printsheet. Thanks for your response.

Page end considering components

First of all, I would like to thank you for this library. I've tried a dozen different libraries for this, and none of them even came close to printing a file that matches the real HTML visualization as this one.

My problem is regarding denoting page endings. Let me show an example:
The content I want to print is a ngFor of a card with variable height (it includes a lot of other components inside it and I can't predict that each card will have a fixed size).
Printing the element shows the components as expected, but since they have different heights, sometimes the page ends don't match the end of the card, so we get cases of one card ending mid-page and another card already right next to it.
The expected behavior I would like is that this card, that would start mid-page, be bumped to the next page, so we don't mix those two cards.

I couldn't find anything in the documentation about it, but something like adding a directive inside the card, that bumps it into the next page, would work.

Is there anything implemented in regards to this use-case?

Thank you.

Edit: I tried break-after and break-before CSS attributes, but none of them seemed to work with Material Angular on Chrome.

Print Issue

Describe the bug
Text is breaking into next page. Attached the screenshot.

To Reproduce
Steps to reproduce the behavior.

Expected behavior
When text is exceeding the page it should not cut the words. It should move the data into next page.

Screenshots
Attached.

Desktop (please complete the following information):

  • OS: Windows
  • Chrome
  • Version 78.0.3904.87 (Official Build) (64-bit)

Additional context
img

I can't print value of input

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Chrome closing window before print - in latest mac version (78.0.3904.70)

Describe the bug
The newly opened tab is closed even before the print dialog appears.

To Reproduce
If we click on print button in latest chrome, the tab closes even before print dialog appears.

Expected behavior
Opened tab should not close before print dialog appears.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [Mac]
  • Browser [chrome]
  • Version [78.0.3904.70]

Blank Print preview in iPad

The print action produces blank print preview in iPad. If printed, it just prints blank screen. I tried it even with a simple text eg "Hello World" inside print section but it produces the same issue. Other than iPad, it works in all other devices, please help.

Sample code:
Print

Hello World

Print onInit

Is your feature request related to a problem? Please describe.
Hi, thanks for the nice library! I would like to know if there is a way to trigger the print window on component init.

Describe the solution you'd like
I would like to be able to trigger the print window on init because I use material angular and when I want to print a table I need to write cutom rules for the non standart tags (mat-table, mat-cell etc.).

Describe alternatives you've considered
What I think I can do now is trigger the click event on the button but can I do something different?

Position of print window

Idea: make it possible to set the position of the print window.

Possible implementations:

  • An input variable position that accept 'top' | 'center' | 'center top' | ... as possible values. Depending on the chosen value, calculate top/bottom/left/right.
  • More flexible for the user: allow the user to fill in the values themselves for top/bottom/left/right.

Created window closes before print dialog appears (safari 12.1.2 )

Describe the bug
When working with a large number of rendering elements on the view, the newly opened window closes even before the print dialog comes up.

Expected behavior
The print dialog should be shown and then it can be closed after printing.

Desktop (please complete the following information):

  • OS: MacOSX Mojave
  • Browser Safari
  • Version 12.1.2

Additional context
The issue is solved if we use setTimeout within.

The package doesn't work in angular 4

@selemxmn

After installing the package in angular 4 i can't use it always gives me the following error
Metadata version mismatch for module node_modules/ngx-print/ngx-print.d.ts, found version 4, expected 3.

I use

  • Windows 10
  • Browser chrome
  • Angular version
    @angular/cli: 1.4.10
    node: 10.15.3
    os: win32 x64
    @angular/animations: 4.4.7
    @angular/common: 4.4.6
    @angular/compiler: 4.4.6
    @angular/core: 4.4.6
    @angular/forms: 4.4.6
    @angular/http: 4.4.6
    @angular/platform-browser: 4.4.6
    @angular/platform-browser-dynamic: 4.4.6
    @angular/router: 4.4.6
    @angular/cli: 1.4.10
    @angular/compiler-cli: 4.4.6
    @angular/language-service: 4.4.6
    typescript: 2.3.4

ngx-print does not support the existing styles and @media print styles

Add any css style to html through style sheet. Example color: red. This will not be reflected in print page and when the same is added under @media print ,not reflecting in print page.

Give more support to existing styles sheets and where as while using print style, styles for tables tr TD are not reflected

OS windows, browser: chrome and all

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.