Archive for March, 2009
The implementation is mostly straightforward, but there are are some complications - some shapes (arcs etc.) need to be approximated from bezier curves sections, since they don’t exist as primitives in PDF (Oddly, circles and arcs are primitive in PostScript).
In common with GraphPS, it doesn’t yet support the bitmapped image parts of the Graphics module, though that would be easy to add.
Here’s a particularly luridly coloured example (source PDF here):
GraphPDF will ship with the next release of CamlPDF.
What might be nice for the future would be a single module shipping with OCaml which can be used as the ordinary graphics module would be, and then dump the result to PDF when required.
We’d need to extend the graphics module with the ability to optionally keep a list of all commands executed thus far, but that’s about all. Getting the PDF output into Ocaml would require some license work on CamlPDF, though, so won’t happen yet.