Convert given source code into .pdf with syntax highlighting and more features

Overview

Code2pdf πŸ“ 

Convert given source code into .pdf with syntax highlighting and more features

Build Status Version Downloads Python
Build Status PyPI version PyPi downloads PyPI

Demo

demo

Installation

Build from source
git clone https://github.com/tushar-rishav/code2pdf.git
cd code2pdf
pip3 install .

Or

Using pip
pip3 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
  • 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
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 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! 😊

While creating a PR, please update the Contributor section too( see below ).

Contributor

Christopher Welborn

cclauss

Thommy257

Owner
Tushar Gautam
Learning a bit of everything. Formerly: Google Summer of Code, 2016 @coala
Tushar Gautam
Excalibur: A web interface to extract tabular data from PDFs

Excalibur: A web interface to extract tabular data from PDFs Excalibur is a web interface to extract tabular data from PDFs, written in Python 3! It i

1.2k Jan 04, 2023
A simple Python script to convert multiple images (well technically also a single image) into a pdf.

PythonImage2PDF A simple Python script to convert multiple images into a single PDF-document. Created basically for only my own needs for converting m

Joona Gynther 1 Jun 28, 2022
Program that locks/unlocks pdf files🐍

🐍 πŸ“„ PDFtools πŸ“„ 🐍 Programa que bloqueia/desbloqueia arquivos pdf Requisitos β€’ Como usar β€’ Capturas de Tela 🚨 Aviso 🚨 Altere os caminhos referente

JoΓ£o Victor Vilela dos Santos 1 Nov 04, 2021
OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched

OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched or copy-pasted. ocrmypdf

8k Jan 08, 2023
A Python tool to generate a static HTML file that represents the internal structure of a PDF file

PDFSyntax A Python tool to generate a static HTML file that represents the internal structure of a PDF file At some point the low-level functions deve

Martin D. 394 Dec 30, 2022
Zen-Knit is a formal (PDF), informal (HTML) report generator for data analyst and data scientist who wants to use python.

About Zen-Knit: Zen-Knit is a formal (PDF), informal (HTML) report generator for data analyst and data scientist who wants to use python. Inspired fro

Zen Reportz 27 Jul 13, 2022
Convert Lecture Videos to PDF

Convert Lecture Videos to PDF Description Want to go through lecture videos faster without missing any information? Wish you can read the lecture vide

Emilio Kartono 20 Nov 25, 2022
Converting Html files to pdf using python script, pdfkit module and wkhtmltopdf.

Html-to-pdf-pdfkit-wkhtml- This repository has code for converting local html files and online html resources into pdf. It is an python script which u

Hemachandran P 1 Nov 09, 2021
Python bindings for MuPDF's rendering library.

PyMuPDF 1.19.3 Release date: December 15, 2021 On PyPI since August 2016: Author Jorj X. McKie, based on original code by Ruikai Liu. Introduction PyM

Jorj X. McKie 0 Nov 03, 2022
PyPDF2 is a pure-python PDF library capable of splitting, merging together, cropping, and transforming the pages of PDF files.

PyPDF2 is a pure-python PDF library capable of splitting, merging together, cropping, and transforming the pages of PDF files. It can also add custom data, viewing options, and passwords to PDF files

Matthew Stamy 5k Jan 04, 2023
Split given PDF document into 4 page groups and convert them to booklet format

PUTO: PDF to Booklet converter Split given PDF document into 4 page groups and convert them to booklet format. It creates a PDF like shown below: Fir

3 Mar 12, 2022
rst2pdf: Use a text editor. Make a PDF.

rst2pdf: Use a text editor. Make a PDF.

rst2pdf 487 Jan 06, 2023
this is simple program, that converts pdf file to png

author: a5892731 last update:2021-11-01 version: 1.1 resources: -https://pypi.org/project/pdf2image/ -https://github.com/oschwartz10612/poppler-window

1 Nov 01, 2021
Simple pdf editor while preserving structure and format.

SIMPdf Simple pdf editor while preserving structure and format.

Shashwat Singh 242 Jan 04, 2023
PyMuPDF is a Python binding with support for MuPDF

PyMuPDF is a Python binding with support for MuPDF (current version 1.18.*), a lightweight PDF, XPS, and E-book viewer, renderer, and toolkit, which is maintained and developed by Artifex Software, I

PyMuPDF 1.9k Jan 03, 2023
PDFSanitizer - Renders possibly unsafe PDF files and outputs harmless PDF files

PDFSanitizer Renders possibly malicious PDF files and outputs harmless PDF files

9 Jan 30, 2022
Table automatically extraction from PDF Document

PDF Table Extractor Table automatically extraction from PDF Document Our Icon πŸ“Œ Name : PDF Table Extractor πŸ“Œ Authors : Minku Koo Jiyong Park πŸ“Œ Deve

1 Jan 10, 2022
Small python-gtk application, which helps the user to merge or split pdf documents and rotate, crop and rearrange their pages using an interactive and intuitive graphical interface

Small python-gtk application, which helps the user to merge or split pdf documents and rotate, crop and rearrange their pages using an interactive and intuitive graphical interface

1.8k Dec 29, 2022
WeasyPrint is a smart solution helping web developers to create PDF documents.

WeasyPrint is a smart solution helping web developers to create PDF documents. It turns simple HTML pages into gorgeous statistical reports, invoices, tickets…

Kozea 5.4k Jan 08, 2023
Camelot is a Python library that makes it easy for anyone to extract tables from PDF files

Camelot: PDF Table Extraction for Humans Camelot is a Python library that makes it easy for anyone to extract tables from PDF files! Note: You can als

Atlan Technologies Pvt Ltd 3.3k Jan 06, 2023