home.html
<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button (click)="sharePicker()">
<ion-icon name="Share-alt" color="light"></ion-icon>
</ion-fab-button>
</ion-fab>
home.ts
async sharePicker() {
var doc = new jsPDF();
var col = ["Id", "Brand name"];
var rows = [];
this.brand.forEach(element => {
var temp = [
element.id,
element.name,
];
console.log("temp", temp)
rows.push(temp);
});
doc.autoTable(col, rows);
doc.save("BrandList.pdf");
this.platform.ready()
.then(() => {
this.socialSharing.share(null, null, doc.save("BrandList.pdf"), null)
.then((data) => {
console.log('Shared via SharePicker');
}).catch((err) => {
console.log('Was not shared via SharePicker');
});
});
}
Items List get Directly to the Database and Added to the col Parameter,
I want when i click FAB Button, then PDF Generate Automatically, and open the share Option and Send PDF on Social Media, like, whatsapp, fb, etc
this code generate PDF in Browser but not on Device.