html-to-document-adapter-pdf
Version:
PDF adapter for html-to-document-core — converts a DocumentElement tree into .pdf using the html2pdf.js library.
13 lines (12 loc) • 403 B
JavaScript
// Utility functions for PDF adapter
export function createTempFileName(extension) {
const timestamp = Date.now();
const random = Math.random().toString(36).substring(7);
return `temp-${timestamp}-${random}.${extension}`;
}
export function isNodeEnvironment() {
return typeof window === 'undefined';
}
export function isBrowserEnvironment() {
return typeof window !== 'undefined';
}