Fix #330 Missed android functionality
This commit is contained in:
parent
02843b1990
commit
1ed7ec2bbb
|
|
@ -2,6 +2,7 @@ import { blobToBase64,encryptObject, pdfDiv } from "../../../../Services/Others"
|
|||
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
|
||||
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
|
||||
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
|
||||
import { downloadFile } from "../../../../utils/downloadFile";
|
||||
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
||||
export const MobilePdfPrint = async ({
|
||||
printerTemplateStyle = 'Style 13',
|
||||
|
|
@ -111,14 +112,26 @@ export const MobilePdfPrint = async ({
|
|||
|
||||
if (PrintComing === 'download') {
|
||||
// 📥 Download PDF
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(pdfBlob);
|
||||
link.download = `Receipt_${new Date().getTime()}.pdf`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(link.href);
|
||||
// const link = document.createElement('a');
|
||||
// link.href = URL.createObjectURL(pdfBlob);
|
||||
// link.download = `Receipt_${new Date().getTime()}.pdf`;
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// URL.revokeObjectURL(link.href);
|
||||
const buffer = await pdfBlob.arrayBuffer();
|
||||
|
||||
downloadFile(
|
||||
buffer,
|
||||
`Receipt_${new Date().getTime()}.pdf`,
|
||||
"application/pdf",
|
||||
(success) => {
|
||||
if (!success) {
|
||||
|
||||
console.error('Failed to download the file. Please try again.');
|
||||
}
|
||||
}
|
||||
);
|
||||
// Clear printed orders
|
||||
setPrintOrderDetails([]);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import { useSelector } from 'react-redux';
|
|||
import excelExport from '../../../Images/xls-export.png';
|
||||
import ExcelJS from 'exceljs';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { downloadFile } from '../../../utils/downloadFile.js';
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
|
||||
|
|
@ -620,8 +621,19 @@ const LedgerReport = () => {
|
|||
hours = String(hours).padStart(2, '0');
|
||||
|
||||
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
|
||||
|
||||
saveAs(blob, fileName);
|
||||
downloadFile(
|
||||
buffer,
|
||||
fileName,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
(success) => {
|
||||
if (success) {
|
||||
console.log("File downloaded and opened successfully!");
|
||||
} else {
|
||||
console.log("Failed to download/open file.");
|
||||
}
|
||||
}
|
||||
);
|
||||
// saveAs(blob, fileName);
|
||||
};
|
||||
|
||||
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);
|
||||
|
|
|
|||
Loading…
Reference in New Issue