Implementing a PDF Library in Ruby

HexaPDF ( is a PDF library written in Ruby. It aims to provide the full spectrum of PDF functionality with the exception of rendering.

This presentation focuses on how HexaPDF implements the PDF specification and how Ruby is actually quite a good language for this task. It is said that Ruby, being a scripting language, is rather slow and, truth be told, it is when compared to languages like C++ or Java. However, by understanding how Ruby internally works and by carefully designing the library we can create quite a performant library while still retaining a Ruby-esque, easy-to-use API.

In this presentation you will learn about HexaPDF’s approach to parsing, how HexaPDF maps the PDF object types to Ruby’s built-in classes, how references and convenience classes are automatically mapped behind the scenes, how algorithmic choices influence performance, and more.