Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tushar-rishav/code2pdf
:fax: Convert various source codes into pdf file with custom features
https://github.com/tushar-rishav/code2pdf
linux pdf-generation python
Last synced: about 6 hours ago
JSON representation
:fax: Convert various source codes into pdf file with custom features
- Host: GitHub
- URL: https://github.com/tushar-rishav/code2pdf
- Owner: tushar-rishav
- License: mit
- Created: 2015-09-19T22:13:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-07-21T21:08:48.000Z (over 2 years ago)
- Last Synced: 2024-10-13T09:47:53.942Z (2 months ago)
- Topics: linux, pdf-generation, python
- Language: Python
- Homepage:
- Size: 160 KB
- Stars: 348
- Watchers: 8
- Forks: 33
- Open Issues: 12
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
- awesome-pdf - code2pdf
README
Code2pdf
--------------Convert various source code into pdf file with syntax highlighting and many more
features`Demo`_
-------
Click above for demoDependencies
~~~~~~~~~~~~`PyQt `__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Installation
~~~~~~~~~~~~Build from source
'''''''''''''''''.. code:: sh
git clone https://github.com/tushar-rishav/code2pdf.git
cd code2pdf
python setup.py installOr
Using pip
'''''''''.. code:: sh
pip install code2pdf
Usage
~~~~~A. As console app
'''''''''''''''''Help
.. code:: sh
code2pdf -h
Usage
``code2pdf [-h] [-l] [-s SIZE] [-S NAME] [-v] filename [outputfile]``
Options
.. code:: sh
positional arguments:
filename absolute path of the python file
outputfile absolute path of the output pdf fileoptional 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.
-v, --version show program's version number and exitAvailable style types are
- [x] autumn
- [x] borland
- [x] bw
- [x] colorful
- [x] default
- [x] emacs
- [x] friendly
- [x] fruity
- [x] igor
- [x] manni
- [x] monokai
- [x] murphy
- [x] native
- [x] paraiso-dark
- [x] paraiso-light
- [x] pastie
- [x] perldoc
- [x] rrt
- [x] tango
- [x] trac
- [x] vim
- [x] vs
- [x] xcodeExample
.. code:: sh
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
B. As module
''''''''''''.. code:: py
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 pdfContributions
~~~~~~~~~~~~~Have an idea to make it better? Go ahead! I will be happy to see a pull
request from you! :blush:
While creating a PR, please update the *Contributor* section too( see below ).Contributor
~~~~~~~~~~~`Christopher Welborn `__
`cclauss `__
.. _Demo: https://cloud.githubusercontent.com/assets/7397433/10060934/645a3cc6-6272-11e5-9ebb-a1ac24c86d67.gif