KoctrX

Untitled

Jan 12th, 2023
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. font = new Promise((resolve, reject) => {
  2. opentype.load(viewer.fonts.g_d0_f1.base64, (err, font) => {
  3. if(err) return reject(err);
  4.  
  5. resolve(font);
  6. });
  7. });
  8.  
  9. path = font.getPath(Object.values(viewer.pages[1].fabricText)[0][0][0].character, 5, 5, 72);
  10. canvas = document.createElement('canvas');
  11. document.body.append(canvas);
  12. ctx = canvas.getContext('2d');
  13. path.draw(ctx)
  14. window.open(URL.createObjectURL(await fetch(canvas.toDataURL()).then(res => res.blob())));
  15.  
Add Comment
Please, Sign In to add comment