-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Description
Since upgrading from pdfjs v2.5.207 to pdfjs v3.3.122 I have had issues with rendering a text layer of pdfs. Previously, for this purpose, class TextLayerBuilder was used and it was working correctly.
This is the code that was used:
const textLayer = new TextLayerBuilder({
eventBus: new Proxy({}, { get: () => () => {} }),
textLayerDiv: this.textLayerElement.nativeElement,
pageIndex: this.page.pageIndex,
viewport,
});
textLayer.setTextContent(this.textContent);
textLayer.render();
Now, the constructor of TextLayerBuilder doesn't accept the same parameters as before and it is not clear how the same behavior should be achieved with these changes. Instead, I tried to use renderTextLayer function:
const renderTextLayerTask = renderTextLayer({
textContentSource: this.textContent,
container: this.textLayerElement.nativeElement,
viewport,
textDivs: [],
});
but it resulted in having issues with the alignment and font size of the pdf text, for example:
I would appreciate if some instructions for overcoming this issue could be provided, either with the usage of TextLayerBuilder or renderTextLayer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels