Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
ngx-printer
Advanced tools
A simple service to print the window or parts of a window (div). Printing of Angular Templates or Components is possible.
A simple service to print the window or parts of a window (div). Printing of Angular Templates or Components is possible.
See DEMO App for examples.
The service prints by opening a new window. There is an option printWindowOpen to change this behavoir. Set printWindowOpen=false;
You can also set this option in .forRoot while importing the module to the app.module
imports: [
BrowserModule,
NgxPrinterModule.forRoot({printOpenWindow: true})
],
this.printerService.printCurrentWindow();
this.printerService.printDiv('idOfDivToPrint');
@ViewChild('PrintTemplate')
private PrintTemplateTpl: TemplateRef<any>;
printTemplate() {
this.printerService.printAngular(this.PrintTemplateTpl);
}
Beware: To print a component the component needs to be known by service (copy source and add it to entry component of app.module). Otherwise use printHTMLElement instead.
@ViewChild(LittleDummyComponent, {read: ElementRef}) PrintComponent: ElementRef;
printHTMLElementToCurrent() {
this.printerService.printHTMLElement(this.PrintComponent.nativeElement);
}
If you want to check whether the print window is open or not subscribe to obserbable $printWindowOpen
this.printWindowSunscription = this.printerService.$printWindowOpen.subscribe(val => {
console.log('Print window is open:', val);
});
FAQs
An easy to use service to print a window or parts of a window (div). Printing of Angular Templates or Components is possible.
The npm package ngx-printer receives a total of 1,878 weekly downloads. As such, ngx-printer popularity was classified as popular.
We found that ngx-printer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.