Convert PDF to MD using pdf2md

806 Views Asked by At

I am encountering an issue with the Turkish language in the output file while utilizing pdf2md library. This problem seems to manifest inconsistently across various documents, appearing in some instances but not in others.

pdf2md github

output

The message when i converting example-normal.pdf file :

Warning: fetchStandardFontData: failed to fetch file "FoxitSans.pfb" with "UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSans.pfb". Writing to example-normal.md... Done.

The message when i converting the example-withe-error.pdf file : Warning: fetchStandardFontData: failed to fetch file "FoxitSerifBold.pfb" with "UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSerifBold.pfb". Warning: fetchStandardFontData: failed to fetch file "FoxitSerifBoldItalic.pfb" with "UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSerifBoldItalic.pfb". Warning: fetchStandardFontData: failed to fetch file "FoxitSerif.pfb" with "UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSerif.pfb". Warning: fetchStandardFontData: failed to fetch file "FoxitSansBoldItalic.pfb" with "UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSansBoldItalic.pfb". Warning: fetchStandardFontData: failed to fetch file "FoxitSerifItalic.pfb" with "UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSerifItalic.pfb". Warning: fetchStandardFontData: failed to fetch file "FoxitSans.pfb" with "UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSans.pfb". Writing to example-withe-error.md... Done.

you can refer to the files illustrating the normal scenario:

Normal Scenario PDF File

Normal Scenario Markdown File

Furthermore, you can view the files showcasing the error scenario:

Error Scenario PDF File

Error Scenario PDF-MD File

output

1

There are 1 best solutions below

0
Priestch On

"UnknownErrorException: Unable to load font data at: C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSans.pfb". Writing to example-withe-error.md... Done.

The font path missing a "\", the path should be some C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fonts\FoxitSans.pfb instead of C:\Users\lorens\Desktop\pdf-md2\node_modules\pdfjs-dist\standard_fontsFoxitSans.pfb.

Check whether you can config some options to change the font path.