19 lines
503 B
TypeScript
19 lines
503 B
TypeScript
import { replaceFileExtension } from "./fileHelpers";
|
|
|
|
export function isDesktopPdfExportAvailable() {
|
|
return Boolean(window.qoffice?.isDesktop && window.qoffice.exportPdf);
|
|
}
|
|
|
|
export async function exportPdfOrPrint(defaultFileName: string) {
|
|
if (isDesktopPdfExportAvailable()) {
|
|
await window.qoffice?.exportPdf?.(pdfFileName(defaultFileName));
|
|
return;
|
|
}
|
|
|
|
window.print();
|
|
}
|
|
|
|
export function pdfFileName(fileName: string) {
|
|
return replaceFileExtension(fileName || "QOffice", ".pdf");
|
|
}
|