Code2pdf
Convert various source code into pdf file with syntax highlighting and many more features
Demo
Click above for demo
Dependencies
PyQt
Installation
Build from source
git clone https://github.com/tushar-rishav/code2pdf.git
cd code2pdf
python setup.py install
Or
Using pip
pip install code2pdf
Usage
A. As console app
Help
code2pdf -h
Usage
code2pdf [-h] [-l] [-s SIZE] [-S NAME] [-v] filename [outputfile]
Options
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.
-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
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
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
License
Metadata
Release files for Code2pdf 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Code2pdf-1.0.0.tar.gz | 4.8 kB | Without provenance | Details for Code2pdf-1.0.0.tar.gz |
Release files / Code2pdf-1.0.0.tar.gz
| Download URL | Code2pdf-1.0.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2d73b942a62262927bf78e8a50d656b761eed8a75030606e63a3e4a54030b2f
|
|
BLAKE2b-256 checksum How to use checksums |
d6586d6fe09138107ced2506bea6615f18c11e7de63b2b6051cdfc88e379162c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Code2pdf 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.