pdf-render: Render PDF files to dc% and picts
This library lets Racket draw PDF files to picts and to dc%
objects. It’s quite hacky and minimal; only including auxiliary
functions to get the page count and page size for now.
This requires libpoppler, and likely only works on Linux or Mac
OSX. Windows might work if you insctall Poppler.
To display a rotated version of the first page of a PDF to the screen, use:
If the PDF is password-protected, you may have to use:
2 PDF file info
This struct allows you to open PDF files from an arbitrary Poppler URI
("file:/tmp/test.pdf" for example) and optionally protected
with a password. Note that the URI must be an absolute path.
Returns the number of pages in path.
Returns the width and height of the page_indexth page. Note that
page_index starts at 0.
This is the page size, not the bounding/crop box! We don’t respect
Renders the page_indexth page, without rasterization, to the
given drawing context.
Produces a pict
containing the page_index
3 Bugs and Issues
Rendering works by reaching into the dc% and pulling out the
cairo drawing context. This is inappropriately low-level.