节点乳胶图像渲染

马特·林赛

我正在尝试使用 LaTeX 的 graphicsx 包在模板中包含一个 JPEG 图像,但该包似乎没有呈现该图像。我当然可能会省略一些内容,但我已经在下面包含了我的代码以供考虑。

我在 Cloud 9、texlive-full 包和节点 v6.10.2 中使用容器化的 Ubuntu 14.04 实例。

var fs = require('fs');

var input = process.argv[2];
var output = process.argv[3];
var temp = [];

fs.readFile(input, 'utf8', function (err, data) {
  if (err) throw err;
  console.log('>>> Tex file imported.');
  temp.push(data);
  var options = { 'command': 'pdflatex' };
  require('latex')(temp, options).pipe(fs.createWriteStream(output));
  console.log('>>> Tex file built.');
});

我的 tex 文件如下:

\documentclass{article} \usepackage{graphicx} \begin{document} 
\begin{center} \includegraphics[scale=1]{logo.jpg}
\newline \Large NOTICE
\end{center}
\sffamily Account Number: \textit{12345678} \newline
\newline MR A TEST
\newline 2 THE STREET
\newline FARNBERRY
\newline CLOUD TOWN
\newline GU15 3AA \newline
\newline Amount: 1078.52
\newline Financial Year: \textbf{2017}
\newline
\newline \small{Footer text}
\end{document}

如果我使用命令从终端编译这个 tex 文件,>pdflatex filename.tex图像在 PDF 中呈现得很好。你能帮我渲染包含的图像吗?

谢谢。

尼克D

可能的情况是乳胶运行是在某个临时目录中完成的,并且在那里找不到图像。尝试更改\includegraphics以获得图像完整路径

\includegraphics[scale=1]{/full/path/to/directory/containing/logo.jpg}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章