Search code examples
javapdfpretty-print

How can I pretty-print Java source code as a PDF?


I'm planning to put some Java code in an appendix to my report. The report is a PDF document, and I use Eclipse for Java.

How can I present it best and do this easily? Any recommendations?


Solution

  • For this purpose, I created a LaTeX doclet. This is a Javadoc doclet, which converts the javadoc comments to LaTeX code, and (if wanted) also includes a pretty-printed version of the source code of the documented methods.

    You can then convert the generated LaTeX document to PDF, and append it to your report.