Added Dowload feture

This commit is contained in:
Srinath 2026-02-16 14:34:29 +05:30
parent aade736b5c
commit 19af706317
1 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import { PublicQrCodepost } from '../../../../Features/ConfigMasterPage/ConfigMa
import { renderToStaticMarkup } from 'react-dom/server';
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
const uploadApiUrl = import.meta.env.ENV_IMAGE_UPLOAD_API_URL;
// Create a secure blob URL creator that works in all environments
const createSecureBlobUrl = (blob) => {
@ -60,10 +61,10 @@ export const MobileMultiPdfPrint = async ({
dispatch,
UserId = '',
onProgress = () => {},
returnBlob = false,
}) => {
try {
const style = await PrintStyleFunction(printerTemplateStyle, 'Sales');
const stylesMap = {
'Style 1': 'PrintStyle1',
'Style 2': 'PrintStyle2',
@ -170,6 +171,15 @@ export const MobileMultiPdfPrint = async ({
revokeSecureBlobUrl(blobUrl);
}, 100);
}
// Return blob if requested (after download completes)
if (returnBlob && PrintComing === 'download') {
setPrintOrderDetails([]);
if (container) {
document.body.removeChild(container);
}
return { success: true, pdfBlob: combinedPdfBlob };
}
// if (PrintComing === "whatsapp") {
// const orderIds = PrintOrderDetails.map((row) => row?.OrderId).filter(Boolean);