From 5109ee4ae1fae5cf371c7acbe36991d65ce74dfd Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Tue, 18 Oct 2016 14:13:00 -0700 Subject: [PATCH] Set the correct relative path for font files If I included this as a node module in a project, it threw errors because it couldn't find the TTF files in `temp/`. I updated the path to be the correct relative path using `__dirname` and now it works. --- lib/reader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reader.js b/lib/reader.js index 8acb4e6..36b2f10 100644 --- a/lib/reader.js +++ b/lib/reader.js @@ -50,7 +50,7 @@ PDFJS.FontLoader.bind = function nodeFontLoaderBind(pdf, fonts, callback) { } var fontName = font.loadedName; - var fontFile = 'temp/' + pdf._idx + '_' + fontName + '.ttf'; + var fontFile = __dirname + '/../temp/' + pdf._idx + '_' + fontName + '.ttf'; // Temporary hack for loading the font. Write it to file such that a font // object can get created from it and use it on the context.