You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { toJpeg, toPng } from 'html-to-image';
toJpeg(element, {
// skipFonts: true,
useCORS: true,
preferredFontFormat:'embedded-opentype',
allowTaint: true,
height: element.scrollHeight, //
width: element.scrollWidth,
scale: 1,
backgroundColor: '#ffffff',
pageBreak: { mode: 'avoid-all' }
})
It will take more then 20s to export jpeg...
if I set 'skipFonts: true', It will take 3s to export jpeg...
so how should I do to apply custom fonts?
The text was updated successfully, but these errors were encountered:
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
I have defined some custom fonts:
@font-face {
font-family: 'SourceHanSansCN-Medium';
src: url(../../assets/fonts/SourceHanSansSC-Medium.otf);
}
@font-face {
font-family: 'SourceHanSansCN-Bold';
src: url(../../assets/fonts/SourceHanSansSC-Bold.otf);
}
@font-face {
font-family: 'SourceHanSansSC-Normal';
src: url(../../assets/fonts/SourceHanSansSC-Normal.otf);
}
import { toJpeg, toPng } from 'html-to-image';
toJpeg(element, {
// skipFonts: true,
useCORS: true,
preferredFontFormat:'embedded-opentype',
allowTaint: true,
height: element.scrollHeight, //
width: element.scrollWidth,
scale: 1,
backgroundColor: '#ffffff',
pageBreak: { mode: 'avoid-all' }
})
It will take more then 20s to export jpeg...
if I set 'skipFonts: true', It will take 3s to export jpeg...
so how should I do to apply custom fonts?
The text was updated successfully, but these errors were encountered: