ng-html2pdf
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

***.module.ts


import { NgHtml2pdfModule } from 'ng-html2pdf';

@NgModule({
  imports: [
    NgHtml2pdfModule,
  ],
  declarations: [],
  exports: [],
  schemas: []
})
export class DailyModule { }

***.component.ts

import { NgHtml2pdfService } from 'ng-html2pdf';

constructor(private html2pdf: NgHtml2pdfService) { }

downloadPdf(ele: HTMLElement, title) {
  this.html2pdf.createPdf(ele, title);
}

***.component.html

  <div id="printbox" #pdf>
    <div nz-row>
      <div nz-col nzSpan="12">影片排次号:{{movieCode}}</div>
      <div nz-col nzSpan="12">资料来源:{{schedule}}</div>
    </div>
    <div nz-row>
      <div nz-col nzSpan="12">填报单位:{{projectType | project_type: false}}</div>
      <div nz-col nzSpan="12">填报日期:{{date}}</div>
    </div>
  </div>
  <button nz-button nzType="primary" (click)="downloadPdf()"><i nz-icon nzType="download"
      nzTheme="outline"></i>下载pdf</button>

NgHtml2pdf

This library was generated with Angular CLI version 10.2.0.

Code scaffolding

Run ng generate component component-name --project ng-html2pdf to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ng-html2pdf.

Note: Don't forget to add --project ng-html2pdf or else it will be added to the default project in your angular.json file.

Build

Run ng build ng-html2pdf to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build ng-html2pdf, go to the dist folder cd dist/ng-html2pdf and run npm publish.

Running unit tests

Run ng test ng-html2pdf to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

Readme

Keywords

Package Sidebar

Install

npm i ng-html2pdf

Weekly Downloads

36

Version

0.0.7

License

MIT

Unpacked Size

36.8 kB

Total Files

17

Last publish

Collaborators

  • litwak