All I want to do is. . .

. . .turn source code into a PDF.

OS:
Tags:

For those times when you need to print your code.
Contributors: anschwa Updated: 10/10/15

Turn source code into a PDF.

  1. Use Org-Mode
  2. Use Pandoc
  3. Use a2ps and ps2pdf

Org-Mode

C-x C-e l p

Pandoc

pandoc -s example.py -o example.pdf

as2ps

Convert all .cpp files in a directory

for i in ls *.cpp; do a2ps -o $i.ps $i; done;

Convert all .ps files to pdf

for i in ls *.ps; do ps2pdf $i; done;

(May need to remove empty side-effect ls.pdf file).

Concatenate all output pdf files

pdftk *.pdf cat output merged.pdf

Raw: source-code-to-pdf.md


If you have suggestions, corrections, or content to contribute, fork us at our Github repo or open an issue.

Licensed under the CC-SA.