I am using pdfjs-lib npm package for PDF parsing and converting to canvas and returning as buffer image format, but unfortunately while parsing a PDF it returns only half the content, the issue I got
"Warning: fetchStandardFontData: failed to fetch file "LiberationSans-Regular.ttf" with "UnknownErrorException: The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.".
`const pdfjsLib = require("pdfjs-dist/build/pdf.js");
const pdfjsWorker = require('pdfjs-dist/build/pdf.worker.entry.js');
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker;
pdfjsLib.disableFontFace = true;
const loadingTask = pdfjsLib.getDocument({ data: pdfData });
const pdf = await loadingTask.promise;
const page = await pdf.getPage(pageNumber);`
This are my code configuration in nodejs
Bing AI response
It seems that you are getting a warning message from pdfjs-dist, a library for parsing and rendering PDF documents in Node.js. The warning indicates that the library could not fetch a font file named "LiberationSans-Regular.ttf", which is a standard font used by PDF documents. This could cause some text to be missing or rendered incorrectly in the output.
One possible reason for this warning is that you did not specify the standardFontDataUrl option when calling the getDocument method. This option tells the library where to find the font files that are needed for rendering the PDF. You can either provide a URL to a folder that contains the font files, or a function that returns a URL for a given font name. For example:
You can find more information and examples on how to use the standardFontDataUrl option in the following link: StandardFontDataFactory - pdfjs-dist - GitHub pdfjs-dist font loading issue in nodejs
I hope this helps you with your problem. Have a nice day! blush