Convert given source code into .pdf with syntax highlighting and more features
Build Status | Version | Downloads | Python |
---|---|---|---|
git clone https://github.com/tushar-rishav/code2pdf.git
cd code2pdf
python setup.py install
Or
pip install code2pdf
code2pdf -h
code2pdf [-h] [-l] [-s SIZE] [-S NAME] [-f] [-v] filename [outputfile]
positional arguments:
filename absolute path of the python file
outputfile absolute path of the output pdf file
optional arguments:
-h, --help show this help message and exit
-l, --linenos include line numbers.
-s SIZE, --size SIZE PDF size. A2,A3,A4,A5 etc
-S NAME, --style NAME
the style name for highlighting. Eg. emacs, vim style etc.
-f,--filelist filename contains list of files to be converted
-v, --version show program's version number and exit
- autumn
- borland
- bw
- colorful
- default
- emacs
- friendly
- fruity
- igor
- manni
- monokai
- murphy
- native
- paraiso-dark
- paraiso-light
- pastie
- perldoc
- rrt
- tango
- trac
- vim
- vs
- xcode
code2pdf -l -s a3 -S emacs ~/Code2Pdf/Code2pdf/code2pdf.py ~/Code2Pdf/Demo/demo.pdf
To see the demo for above check Demo/
in github repo
from Code2pdf.code2pdf import Code2pdf
ifile,ofile,size = "test.py", "test.pdf", "A4"
pdf = Code2pdf(ifile, ofile, size) # create the Code2pdf object
pdf.init_print() # call print method to print pdf
Have an idea to make it better? Go ahead! I will be happy to see a pull request from you! 😊
While creating a PR, please update the Contributor section too( see below ).