Closed cindyloo closed 8 months ago
addendum, I also hid the canvas just to see if the textLayer would look ok with the new font. It has some skips and overwritings, so I don't think that is the right way to do it?
You can't alter PDF font. PDF.js will set a font for each node it renders. You can only set font for stuff you render yourself, like a watermark.
Before you start - checklist
Description
my assumption is that getting the canvas context from
Page
and setting it means that I can alter the font ( looking at the example here: https://jsfiddle.net/cxrznbso/1/ ). However, it appears that any of my changes apply to after the first writing to the canvas. I realize I don't exactly know how the PDF text is rendered to the canvas, but it seems that insidePageCanvas
there would be the options to pass in a Font spec insidefunction drawPageOnCanvas()
?Is there a way to override the default 'system' font in canvas after the loading of the PDF and before the content is first rendered? I've tried almost all the handlers that are exposed to
Page
thank you
Steps to reproduce
use a callback handler to try to change canvas font
Expected behavior
I would think that instead of the system font, I'd have the text in the desired Courier font:
Actual behavior
Additional information
No response
Environment