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
Web browser and its version: I'm using NodeJS not browser
Operating system and its version: Windows 10
PDF.js version: "^2.5.207",
Is a browser extension: No
Steps to reproduce the problem:
constpdf="https://www.interno.gov.it/sites/default/files/2020-10/modello_autodichiarazione_editabile_ottobre_2020.pdf";(asyncfunction(){constpdfBuffer=awaitfetch(pdf).then(res=>res.buffer()).then(buffer=>buffer);awaitconvert2PNG(file);asyncfunctionconvert2PNG(pdfFile){PDFJavaScript.disableWorker=true;PDFJavaScript.disableFontFace=true;constloadingTask=pdfjsLib.getDocument(pdfFile);constpdfDocument=awaitloadingTask.promise;constpage=awaitpdfDocument.getPage(1);constviewport=page.getViewport({scale: 1.0});constcanvasFactory=newNodeCanvasFactory();constcanvasAndContext=canvasFactory.create(viewport.width,viewport.height);constrenderContext={canvasContext: canvasAndContext.context,viewport: viewport,canvasFactory: canvasFactory,renderInteractiveForms: true,};awaitpage.render(renderContext).promise;constimage=canvasAndContext.canvas.toBuffer();fs.writeFile("output.png",image,function(error){if(error){console.error("Error: "+error);}else{console.log("Finished converting first page of PDF file to a PNG image.");}});}});
What is the expected behavior?
What went wrong?
The initial part of PDF, and font is not rendered at all.
I noticed that fonts are not embedded, so may I ask is there a way to embed missing fonts?
The text was updated successfully, but these errors were encountered:
Link to PDF file:
https://www.interno.gov.it/sites/default/files/2020-10/modello_autodichiarazione_editabile_ottobre_2020.pdf
Configuration:
Steps to reproduce the problem:
What is the expected behavior?
What went wrong?
The initial part of PDF, and font is not rendered at all.
I noticed that fonts are not embedded, so may I ask is there a way to embed missing fonts?
The text was updated successfully, but these errors were encountered: