0

I am trying to convert all the php files that can be found inside a directory to pdf.

I am trying to use pandoc, but I am not able to find the correct option for the correct convertion.

When I do

for file in *.php; do pandoc "$file" -o "$file.pdf"; done

I get a lot of execution errors and it suggests to use pandoc with the option

--latex-engine=xelatex

When I use this option, there is no execution error, but the document does not reflect exactly the original document.

Is it possible to do that using pandoc? Otherwise, is there another way to do that?

DanielTheRocketMan
  • 3,199
  • 5
  • 36
  • 65
  • What should the resulting PDFs contain? Are you looking for syntax highlighted source code? – ChrisGPT was on strike Jan 10 '15 at 15:10
  • Yes, highlighted source code would be great. However, I am not even getting the correct pdf source code until now! – DanielTheRocketMan Jan 10 '15 at 15:15
  • 2
    I don't think that Pandoc is the right tool for this. Look at the [list of supported input formats](http://johnmacfarlane.net/pandoc/). Pandoc can handle source code, but as part of a larger document in one of those formats, e.g. as a fenced code block inside Markdown. Perhaps [this question](http://stackoverflow.com/questions/2649373/is-there-a-command-line-c-to-pdf-converter-with-syntax-highlighting) will help. – ChrisGPT was on strike Jan 10 '15 at 15:20

0 Answers0