PDFLibPDF generation for Ring

Getting started

Install the package, create the first PDF and learn the coordinate system.

Install#

Install the package with RingPM, the Ring package manager, in one step:

Shell
ringpm install pdflib from ringpackages

Quick start#

Ring
load "pdflib.ring"

pdf = new PDFWriter()
pdf.setTitle("My First PDF")
pdf.setFont(PDF_HELVETICA_BOLD, 24)
pdf.drawText("Hello, World!", 72, 700)
pdf.save("hello.pdf")

Quick function#

Ring
load "pdflib.ring"

quickPDF("output.pdf", "My Document", [
    [:title = "Page 1", :body = "Content for page 1..."],
    [:title = "Page 2", :body = "Content for page 2..."]
])

Coordinate System#

PDF uses a bottom-left origin:

For A4 paper (595 × 842 pt), the top of the page is y ≈ 842. For typical document layout, start drawing at y = 750 and decrease y for each new line.

PDFLib - PDF generation for Ring, made with ringdoc.