1.0.3 • Published 4 years ago
ng-print-pdf v1.0.3
NgPrintPdf
The library is available as an npm package. This library uses Mozilla PDF.js to support IE11. It uses native api in other browsers.
Install
To install the package run:
npm i ng-print-pdf
Usage
import PrintPdfModule in target module:
import { PrintPdfModule } from 'ng-print-pdf';
@NgModule({
imports: [PrintPdfModule]
})
export class AppModule {}
and inject PrintPdfService:
export class PdfService {
constructor(private printPdfService: PrintPdfService) {}
public printFile(blob: Blob) {
return this.printPdfService.printDocument(blob, {
printResolution: 144,
scale: 1,
cssUnits: 78.0 / 72.0,
layout: 'portrait',
});
}
}
Cautions
This solution requires a lot of memory in IE browser. Therefore it's better to add extra check for amount of pages in file.
public async isSafeToPrintPdf(blob: Blob) {
if (!isIE) {
return true;
}
const amountOfPages = await this.printPdfService.getPagesCount(blob)
return amountOfPages < 35;
}
1.0.3
4 years ago
1.0.1
4 years ago
0.0.19
4 years ago
0.0.18
4 years ago
0.0.17
4 years ago
0.0.16
4 years ago
0.0.15
4 years ago
0.0.14
4 years ago
0.0.13
4 years ago
0.0.12
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago