Export a canvas to PDF (top-anchored)
export_pdf.RdOpens a PDF device, draws a grob top-aligned, and closes the device.
Usage
export_pdf(
grob,
file = "infographic_layout.pdf",
width = unit(8.5, "in"),
height = unit(11, "in"),
margin_top = unit(0, "in"),
margin_right = unit(0, "in"),
margin_bottom = unit(0, "in"),
margin_left = unit(0, "in")
)
export_pdf_top(
grob,
file = "infographic_layout.pdf",
width = unit(8.5, "in"),
height = unit(11, "in"),
margin_top = unit(0, "in"),
margin_right = unit(0, "in"),
margin_bottom = unit(0, "in"),
margin_left = unit(0, "in")
)Details
`export_pdf()` uses `cairo_pdf()` when Cairo is available, which provides full UTF-8 support (bullet points, special characters, etc.). If Cairo is unavailable it falls back to `pdf()` with a message.
**Cairo availability by platform:** - **Windows:** bundled with R — no action needed. - **Linux:** usually present; install `libcairo2-dev` if missing. - **macOS:** requires XQuartz (<https://www.xquartz.org>). After installing, restart R and verify with `capabilities("cairo")`.