My new gem: “code2pdf”

My new gem: “code2pdf”


My newest gem code2pdf is a simple and open-source tool for convert your source code to a PDF file. It can be useful if you need to licence you software.


gem install code2pdf


Open a terminal and run:

code2pdf <project path> <blacklist file>

BlackList file example:

The blacklist file must be a yaml file, as such:

  - .git
  - db/migrate
  - doc
  - log
  - public/images
  - public/system
  - script
  - spec
  - tmp
  - vendor
  - .DS_Store
  - .eprj
  - .gitignore
  - .rspec
  - .rvmrc
  - database.yml
  - development.sqlite3
  - application.yml
  - favicon.ico
  - controls.js
  - dragdrop.js
  - effects.js
  - prototype.js
  - rails.js

PDF output example


Please, let me know if you liked or hated it :)

  • What about using a hidden file like .code2pdf inside the project folder? It could be a yaml file where we could set the blacklist and also other options that may be created in the future.

    Anyway, nice job!

  • Great idea! Soon as I can I’ll do that. Thanks Cássio!

  • Hey man, nice job! But you should have created this gem when we were in college, to print our graduation thesis.
    And I’m very happy to see you contributing with the Ruby community.
    BTW, your gem prints projects in other languages?
    see you! my friend from “rosebush” ;D

  • Thanks dude. Yes, it works with codes in any plataforms.

  • Congrats man! Great Idea!
    I’ve been thinking, perhaps your gem could allow a option to render the source codes in differents files.

    I’m thinking in fork your project and add some features and if you like, you can put in official gem :)

  • Thanks Victor!

    Sure, feel free to fork the project :)


Comments are closed.