simPDF

Fast, base-R, multi-page PDF reports on the graphics device.

simPDF lays out reports on R’s built-in pdf() / cairo_pdf() device with a measured flowing layout: every block reports its real width and height, the cursor advances by that measured height, and pages break automatically. Text, tables and matrices therefore never overlap, however many rows or parameters they contain — the failure mode of reports built from hand-computed coordinates.

It is a fast, dependency-light alternative to .Rmd/knitr/LaTeX for fixed-format reports: no external toolchain, one write pass, base R only.

Interactive fillable forms (AcroForm CRFs) are out of scope and handled by the sibling package pdfCRF.

Installation

# from CRAN (once available)
install.packages("simPDF")

# from source
install.packages("simPDF_0.1.0.tar.gz", repos = NULL, type = "source")

Quick start

library(simPDF)

doc <- sp_new("report.pdf", paper = "letter")
frame_set(doc, top = doc$H - 45, bottom = 45, left = 45, right = doc$W - 45)

flow_run(doc, list(
  block_para("Summary", size = 16, font = 2),
  block_rule(),
  block_table(head(mtcars)),                       # measured columns, repeats header, splits pages
  block_para("Diagnostics", size = 12, font = 2),
  block_plot(plot(mpg ~ wt, mtcars), height = 220) # a plot, inline with the text
), footer = block_para("CONFIDENTIAL", size = 8, align = "center"))

sp_close(doc)

See vignette("simPDF") for the full guide.

Features

License

GPL-3. Author/maintainer: Kyun-Seop Bae k@acr.kr.