PDFs with PHP using HTML & CSS

Sample Document

Sample CSS features

What is typeset.sh?

For many projects, you need to create printable PDF documents. Serving as excellent bridges between the digital world to the analog world, PDF documents are useful if you need an invoice for your eCommerce site, a packing slip, a ticket for an event, or simply a report.

However, generating a PDF is not an easy job, not only because of the complexity of the PDF file but also because of the challenge of ensuring correct typesetting. For instance, creating a table for a website is a trivial task: you define the rows and columns and set its content, and it's done, your browser taking care of the rest. Do the same for a PDF, however, and you quickly find yourself positioning each letter, paragraph, and border manually. Drawing a table for a PDF can quickly turn into a major task, requiring multiple pages, a header and footer, columns spread according to their content, merging cells, and more.

Thanks to typeset.sh, you can create your PDF documents as easily as you create a website. HTML and CSS, the language for creating websites, provide the syntax and means to describe paged documents like PDFs, and typeset.sh helps you generate them.

With typeset.sh, we want to give web developers a tool for creating beautiful, print-ready documents while using the technology stack they are already familiar with.

Generating a PDF otherwise can prove frustrating and time-consuming, and small changes can quickly turn into hours of work. Instead of putting up with all that trouble, let us help you and your developer(s)!

CSS w3.org standards

We focus on supporting the HTML and CSS standards (w3.org).

This makes life easy for web developers and saves them a lot of time. Using the technology and coding language they are already familiar with, they never need to learn any complicated new syntax.

See a list of our current supported features
Standard CSS

Font

Support for the common font formats (.otf, .ttf, .woff)

Implement your fonts via CSS the same way you would on your website. You can even use google fonts out of the box.

Font embedding

Small file size

Smart font and image management.

By only adding the font features and glyphs your document actually uses, typeset.sh keeps your file size small.

Images are only attached once, and you can reference each one multiple times without blowing up the document.

Filesize

Font layout & shaping

Use advanced font rendering for your open-type fonts, resulting in more readable and attractive texts.

Font Layout/Shaping

Supporting international scripts

Displaying text is a complex task that not many are aware of.

Scripts can go from right to left, instead of left to right, and those scripts can get mixed together, creating a bi-directional text. Other scripts then change their glyphs appearance depending on their position and the text surrounding them.

Read more about our supported languages & scripts
Internationalization

Written in PHP

The code is accessible, and you can even modify and extend it.

You have access to the full source code, which you can analyze, tweak, or extend as you wish.

Since PHP is one of the most used server-side programming languages, chances are high that you are already equipped to get started and there is no or low setup cost for you.

Written in PHP

Security & privacy

Your data never leaves your system.

When you run the application on your own server, you do not need to transfer any data to us. This is important if your product-sensitive customer data needs to conform to GDPR.

Security & privacy

Performance

Sure, PHP is not C++, but it is fast.

From the very start, performance was a key concern, driving many of our architectural design decisions. We try our best to ensure peak performance. Of course, rendering is a complex process, and it does require some work. You can render small documents with a couple of pages within a few hundred milliseconds. Large documents with lots of text can eat up significant time and memory.

Get in touch with us to see if typeset.sh is the right choice for you!

Performance

Supporting PHP frameworks

Simple integration with known PHP frameworks.

We have started to provide and share our framework-specific components on GitHub to make the implementation process as easy as possible. If your framework is missing, let us know! We are looking for new projects to support other frameworks.

Go to GitHub
Support for PHP frameworks

Composer support (PHP package manager)

Easy access to updates with composer.

If your application is written in PHP, then you can implement typeset.sh easily by using composer (a PHP package manager).

Otherwise, you can use a single executable phar file to render your document using your language stack. Read more about this in the documentation.

Composer support (PHP package manager)