Giter Club home page Giter Club logo

source2pdf's Introduction

Source2PDF

Source2PDF is a commandline tool, and python library used for the creation of syntax highlighted pdf documents containing software source code.

Source2PDF is currently capable of generating a single pdf document of an entire project by recursively scanning the project directory for relevant source files. It is also possible to instruct Source2PDF to exclude certain documents or folders using regular expressions.

Here is an example of the output you can expect: Source2PDF.pdf

For information about the license, check Source2PDF.py

Installation

Uses python 2.7x

Required packages python libaries which can be installed using pip. I have pip for python 2.7x aliased to pip2 on my system.

    $ pip2 install -r requirements.txt

I have not tested this software on windows yet, but it should work provided you can get the dependencies installed.

Usage

Command line usage:

    usage: Source2Pdf.py [-h] [-e [Ext [Ext ...]]] [-x [Regex [Regex ...]]]
        [-o [File]] [-u [USERNAME]] [-n [PROJECT_NAME]]
        [--style [{monokai,manni,rrt,perldoc,borland,colorful,default,murphy,vs,trac,tango,fruity,autumn,bw,emacs,vim,pastie,friendly,native}]]
        [-l] [-i [File [File ...]]]

        Convert code to PDF files

        optional arguments:
          -h, --help            show this help message and exit
          -e [Ext [Ext ...]], --ext [Ext [Ext ...]]
                                the letters of the file extensions
          -x [Regex [Regex ...]], --exclude [Regex [Regex ...]]
                                each element of exclude is a regex to be excluded
          -o [File]             name of output file
          -u [USERNAME], --user-name [USERNAME]
                                set custom user name
          -n [PROJECT_NAME], --project-name [PROJECT_NAME]
                                set custom project name
          --style [{monokai,manni,rrt,perldoc,borland,colorful,default,murphy,vs,trac,tango,fruity,autumn,bw,emacs,vim,pastie,friendly,native}]
                                set pygments style
          -l, --line-numbers    use line numbers
          -i [File [File ...]]  file names to be converted

Make sure to check out build_pdf.sh as an example of usage

Future Work

I'm considering implementing the following functionality:

  • binary exe package and installer for windows
  • gui using python-pyside or wxpython
  • index page, possibly with links to other sections in the pdf
  • web application using web2py

source2pdf's People

Contributors

kellpossible avatar

Stargazers

Kaptian Core avatar  avatar Andrew Cain avatar

Watchers

Andrew Cain avatar James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.