Qu

pdf.render

Builtin index · File I/O

pdf.render(src, [page=1], [dpi=150])

Input: src, page, dpi · Output: no output

What it is

Renders one page (numbered from 1) to an Image -- text, vector graphics, images and annotations, composited onto white -- at dpi dots per inch (a page is width_in_points * dpi / 72 pixels wide). src is a path or a Vec of bytes. Rasterising PDF needs a real PDF engine, so this uses Google's PDFium (the one inside Chrome), loaded when first called rather than compiled in: download pdfium.dll / libpdfium.so / libpdfium.dylib for your platform from github.com/bblanchon/pdfium-binaries and put it next to the qu program, or set QU_PDFIUM to its path (a file or its folder); the system library path is searched last. Without it the call is an error saying exactly that. Pair with save_image(path, img) to write a PNG.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
pdf.render(src, [page=1], [dpi=150])
src Vecsrc is a path or a Vec of bytes.
page Image or vector, optional (default 1)Renders one page (numbered from 1) to an Image -- text, vector graphics, images and annotations, composited onto white -- at dpi dots per inch (a page is width_in_points * dpi / 72 pixels wide).
dpi Image or vector, optional (default 150)Renders one page (numbered from 1) to an Image -- text, vector graphics, images and annotations, composited onto white -- at dpi dots per inch (a page is width_in_points * dpi / 72 pixels wide).
not documented yetRasterising PDF needs a real PDF engine, so this uses Google's PDFium (the one inside Chrome), loaded when first called rather than compiled in: download pdfium.dll / libpdfium.so / libpdfium.dylib for your platform from github.com/bblanchon/pdfium-binaries and put it next to the qu program, or set QU_PDFIUM to its path (a file or its folder); the system library path is searched last. Without it the call is an error saying exactly that. Pair with save_image(path, img) to write a PNG.

Examples

No documentation example calls this form yet. The File I/O chapter is where one belongs.

How it works

pdf.render(src, [page=1], [dpi=150]) -- one page to an Image, through PDFium loaded at run time (see qu_pdf::render for where the library is looked for).

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.