Closed jamesqquick closed 6 years ago
Do you have latex
installed on your computer? Meaning if you open up a terminal and type in pdflatex --version
, do you get any output?
Thanks for the quick response. I do not have that installed. I didn't see that as a requirement in the ReadMe. Is there a recommended way to install?
Ok got rid of that error by doing an install of Latex. didn't realize that was a separate thing to install. It's also surprisingly big, oh well. I'm going to do a pull request and add a line to readme to install.
Thanks again!
Even if I have latex
installed in my local machine. I am having same issue.
Potentially a PATH issue then? Are you able to run pdflatex
from your terminal?
I have install latex and able to run the pdflatex command. But I still get the error: Error: Error: Unable to run pdflatex command.
MiKTeX-pdfTeX 4.6.1 (MiKTeX 21.6) © 1982 D. E. Knuth, © 1996-2021 Hà n Thế Thà nh TeX is a trademark of the American Mathematical Society. using bzip2 version 1.0.8, 13-Jul-2019 compiled with curl version 7.72.0; using libcurl/7.72.0 Schannel compiled with expat version 2.2.10; using expat_2.2.10 compiled with jpeg version 9.4 compiled with liblzma version 50020052; using 50020052 compiled with libpng version 1.6.37; using 1.6.37 compiled with libressl version LibreSSL 3.1.4; using LibreSSL 3.1.4 compiled with MiKTeX Application Framework version 4.1.1; using 4.1.1 compiled with MiKTeX Core version 4.6; using 4.6 compiled with MiKTeX Archive Extractor version 4.0; using 4.0 compiled with MiKTeX Package Manager version 4.3; using 4.3 compiled with uriparser version 0.9.4 compiled with xpdf version 4.02 compiled with zlib version 1.2.11; using 1.2.11
In your terminal, can you type which pdflatex
and see what path is printed?
And then can you try passing the entire path to the latex
function options.
const input = fs.createReadStream('input.tex')
const output = fs.createWriteStream('output.pdf')
const pdf = latex(input, {
cmd: '/path/to/pdflatex'
})
pdf.pipe(output)
pdf.on('error', err => console.error(err))
pdf.on('finish', () => console.log('PDF generated!'))
Okay. Will try this
On Sat, Aug 7, 2021 at 7:39 PM Saad Quadri @.***> wrote:
Can you type which pdflatex and see what path is printed?
And then can you try passing the entire path to the latex function options.
const input = fs.createReadStream('input.tex') const output = fs.createWriteStream('output.pdf')
const pdf = latex(input, { cmd: '/path/to/pdflatex' })
pdf.pipe(output) pdf.on('error', err => console.error(err)) pdf.on('finish', () => console.log('PDF generated!'))
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/saadq/node-latex/issues/10#issuecomment-894691440, or unsubscribe https://github.com/notifications/unsubscribe-auth/APYTGZA5JCQ7JF5SN6UZUSLT3V4X5ANCNFSM4EC5DFDQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
it still giving me error
const createNewPdf = await new Promise((resolve, reject) => { const input = fs.createReadStream(path.join(dirname + "/../latex/pledge.tex")); const output = fs.createWriteStream(path.join(dirname + "/../latex/output.pdf")); const pdf = latex(input, { cmd: "/usr/bin/pdflatex", inputs: path.join(__dirname + "/../latex/"), }); pdf.pipe(output); pdf.on("error", (err) => { console.log(err); logger.error("Pocket services v2", "upload to s3 inside promise", err); reject(false); }); pdf.on("finish", () => { logger.info("Pocket services v2", "upload to s3", "File Created"); resolve(true); }); });
I've copied over the simple example from the repo, and tried to run it but I get an unhandled 'error' each time. Not getting insightful feedback from this, so not sure how to debug...