When I click print btn then receive the PDF URL from backend at that moment How to direct print in the window print option?
const print= async (pId) => {
try {
const URL = `/printAPI/${pId}`;
const { success, data } = await fetcher(URL);
if (data && success) {
const URL = data?.url;
const W = window.open(URL);
W.window.print();
}
} catch (error) {
console.error(error);
}
};
<IconButton
color={quickEdit.value ? 'inherit' : 'default'}
onClick={() => {
print(row?.accountId);
}}
>
<Iconify icon="flat-color-icons:print" />
</IconButton>