wnabil / ngx-export-as

Angular 2+ / Ionic 2+ HTML/table element to export it as JSON, XML, PNG, CSV, TXT, MS-Word, Ms-Excel, PDF
MIT License
68 stars 40 forks source link

Custom Header #24

Closed mdsunely closed 5 years ago

mdsunely commented 5 years ago

Hello,

Is there any way that I can't add some extra images and text in header while exporting PDF?

Thanks & Regards Mohammed Sunely

wnabil commented 5 years ago

I think it will work if you added the data at the top of the HTML and hided them with CSS or [hidden] directive, if this did not work then you can make it visible during the exporting and re-hiding it when its done something like this:

this.displaySignature = true;
this.exportAsService.save(this.exportAsConfig, 'My File Name').subscribe(() => {
      // save started
      this.displaySignature = false;
});
<div id="sig" [hidden]="!displaySignature">
</div>

OR more secure with ngIf

<div id="sig" *ngIf="displaySignature">
</div>

I published a new version 1.2.6 in order to support the subscriptions in save method