Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ export async function toSvg<T extends HTMLElement>(
): Promise<string> {
const { width, height } = getImageSize(node, options)
const clonedNode = (await cloneNode(node, options, true)) as HTMLElement
await embedWebFonts(clonedNode, options)
await embedImages(clonedNode, options)
try {
await embedWebFonts(clonedNode, options);
} catch (error) {
console.log('[embedWebFonts error]', error);
}
try {
await embedImages(clonedNode, options);
} catch (error) {
console.log('[embedImages error]', error);
}
applyStyle(clonedNode, options)
const datauri = await nodeToDataURL(clonedNode, width, height)
return datauri
Expand Down
Loading