What hqf-pdf creates

Whole documents — invoices, delivery notes, payslips, contracts — and a small example for every feature they are built from, each creating a real PDF.

Every example comes with its code, written twice over: the same document once in Rust and once in Python. Most have a third button as well: the same document in JSON, the form sent to the service.

What each family is for View the PDFs hqf-pdf created See why the files are twice as light most of the time, often far more, and up to twelve times lighter

Complete business documents

The documents a business sends out every day, produced by the software that already holds the figures. What this is for

The technical detail

Each of the families below takes one thing a page can carry and shows it on its own. They are here so that whoever writes your software can see exactly how each is done.

Pages, text and fonts

The page itself, the words on it, and the font — carried inside the file so the page looks the same everywhere. What this is for

Paragraphs, columns and typography

You supply the text; the library works out where each line ends, where each column stops and where each page breaks. What this is for

Tabs and tab stops

The same tabulated rows under each of the three methods, then a contents block whose dots run out to a stop on the right. A tabulation can step on from wherever the text stopped, land on the regular grid of a typewriter, or aim at a stop of its own, on which the text that follows starts, centres, or lines up by its decimal point.

Read the source in: Rust Python JSON

Tables

Tables that fit their columns to the content, split across pages and repeat the heading row on each new page. What this is for

A self-paginating table

A long table handed over whole, deciding for itself where the pages break: its heading on top of every page, its footnote under every page, its grey grounds stated once for the whole table, and a note you draw under each page at the exact place the table reports.

Read the source in: Rust Python JSON

Pictures inside table cells

A catalogue whose first column is a picture rather than text: four pictures of very different sizes and proportions, each fitted whole and undistorted into the cell the table gives it and standing against a different corner of it, claiming no width from its column and no height from its row.

Read the source in: Rust Python JSON

A page and a stamp inside table cells

A checking page for a pack somebody else sent: every row shows one of its pages, taken whole out of the file it arrived in, beside a stamp drawn once and placed in every row that was given it. Both are fitted to the cell the table leaves them, claiming no width from their column and no height from their row.

Read the source in: Rust Python JSON

A figure that says which headings reach it

Takings for thirty branches, quarter by quarter, over two pages. Every amount on the page carries the headings it stands under: the branch beside it, the quarter over it, and the year over the four quarters together. Read aloud, an amount is announced by its town, its quarter and its year before the sum itself.

Read the source in: Rust Python JSON

Colour, inks and printing

The colour you set is the colour that goes to the press, and the printing works takes the file as it stands. What this is for

A sheet prepared for the printing works

One sheet larger than the finished page: the colour runs three millimetres past the blade, the trim marks stand outside it in an ink every plate carries, every colour is said in the four printing inks, and the page names the paper, the edge of the ink and the cut. Hand it the profile of a press and it claims PDF/X-4, and the sheet prints on itself which profile it is standing on.

Read the source in: Rust Python JSON

Drawing, patterns and transparency

Lines, shapes, gradients and transparency drawn as instructions in the file, not as pixels — sharp at any size, and weighing almost nothing. What this is for

A plan that shows what can be read

A land plan whose layers decide by themselves when to appear. A wide name stands over the plot while the plan is looked at whole, the fine wall figures come in once it is enlarged twice over, and the sentence under the plan is there in two languages, of which reading software shows the one it is set to.

Read the source in: Rust Python JSON

Images

Photographs placed at the size and the position you choose, from the image files a camera or a scanner already produces. What this is for

A picture fitted into a rectangle

One picture fitted into a rectangle of one size eight ways: three ways of sizing it, the same one stood in the top left corner with a 12-point inset, a quarter turn left, a quarter turn right, a turn of 20 degrees, and a left-to-right mirror — every panel drawing the picture at the place and the size the library worked out.

Read the source in: Rust Python JSON

Barcodes and 2D codes

The codes a till, a warehouse scanner, a boarding gate or a phone reads, printed straight onto the document. What this is for

Forms, stamps and overlays

Boxes the person receiving the form fills in on screen, and your text laid over a template: a PDF file somebody else already made. What this is for

Archiving, accessibility and metadata

Documents that will still open decades from now, that a screen reader can read aloud, and that an accounting system can book without anyone retyping them. What this is for

A file that explains its own entries

A records office's reference, the department it came from, the date until which the document must be kept and its classification, carried inside a file an archive still accepts. No archiving rule knows what a keep-until date is, so each entry carries a description of itself, and that description is what makes a checker accept a fact you alone invented.

Read the source in: Rust Python JSON