I never used it, but there is graphicspdf which implements the Graphics
interface but outputs to PDF (opam install graphicspdf
). Similar for postscript is GraphPS (not packaged in opam).
Alternatively if you program is well designed you should be able to render to multiple backends. In that case Vg allows you to render to PDF, SVG or the html canvas (opam install vg
). There is also ocaml-cairo that provides you bindings to the C library libcairo and allows you to render to multiple rendering backends (opam install cairo
).