forked from cibinjoseph/code2pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
142 lines (96 loc) · 2.82 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Code2pdf
--------------
Convert various source code into pdf file with syntax highlighting and many more
features
`Demo`_
-------
Click above for demo
Dependencies
~~~~~~~~~~~~
`PyQt <http://www.riverbankcomputing.com/software/pyqt/download>`__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Installation
~~~~~~~~~~~~
Build from source
'''''''''''''''''
.. code:: sh
git clone https://github.com/tushar-rishav/code2pdf.git
cd code2pdf
python setup.py install
Or
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] [-f] [-v] filename [outputfile]``
Options
.. code:: sh
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
Available 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] xcode
Example
.. 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 pdf
Contributions
~~~~~~~~~~~~~
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 <https://github.com/cjwelborn>`__
`cclauss <https://github.com/cclauss>`__
`Cibin Joseph <https://github.com/cibinjoseph>`__
License
~~~~~~~
.. figure:: https://cloud.githubusercontent.com/assets/7397433/9025904/67008062-3936-11e5-8803-e5b164a0dfc0.png
:alt: gpl
.. _Demo: https://cloud.githubusercontent.com/assets/7397433/10060934/645a3cc6-6272-11e5-9ebb-a1ac24c86d67.gif