Installation
-
Download the package from github and place the folders inside your magento folder.
-
Create a folder
media/latex/tmp
. Make surelatex
andtmp
have chmod 777. -
Clear the magento cache.
-
Open the file
app/code/local/Cmichi/Latex/etc/Model/Order/Invoice.php
and ensure that$pdflatexPath
is set to the right location. -
That's basically it. If you click
Print
on an invoice detail page you should now get a pdf generated from LaTeX.
To get a detailed output of the error message you can enable $debug = true
in app/code/local/Cmichi/Latex/etc/Model/Order/Invoice.php
.
The debug mode gives detailed output and doesn't delete the generated *.pdf and *.tex files from media/latex/tmp
.
If you get an error like \usepackage{textcomp} ! Emergency stop.
or "Font tcrm1200 at 600 not found"
try these commands to update your TeX configuration.
updmap-sys --syncwithtrees;
updmap --enable Map=txfonts.map;
texhash;
updmap --syncwithtrees;
Still not working?
pdflatex creates a folder ~/.texlive when rendering the pdf. You may experience that if you execute pdflatex in the terminal everything works fine, but if you try it from your webbrowser nothing works. Reason may be that the .texlive folder is not in the search path of your webserver. If you are using php try these command to find out what your actual $PATH is:
print_r('<br />' . shell_exec('kpsewhich -var-value TFMFONTS'));
print_r('<br />pwd:' . shell_exec('pwd'));
You should now see your search path which includes ./.texlive/
for example.
What you have to do now is compile latex in the terminal (via SSH for example), then copy ~/.texlive/
to the pwd printed above (for example /srv/http/magento/
).
Cross-reference streams are not supported yet.
or File is not a pdf
?
Check if you have \pdfminorversion=4
in the top of your LaTeX template, the Zend_Pdf version that currently comes with Magento doesn't support PDF-1.5.