Re: cairo pdf
Christophe Troestler <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Organization | University of Mons |
| Message-ID | <20140422.173524.356880799946769183.Christophe.Troestler@umons.ac.be> |
Hi,
On Tue, 22 Apr 2014 15:02:16 +0000, Hendrik Boom wrote:
>
> http://cairographics.org/cairo-ocaml/ tells me pdf is supported, and
> there's a simple example of using png. But I can't figure out what I
> have to do to get a pdf file.
I regularly generate PDF files with Cairo (cairo2 in opam). Example
let cr = Cairo.create (Cairo.PDF.create "cloud.pdf" 600. 400.) in
(* draw *)
Cairo.Surface.finish (get_target cr)
- documentation : http://cairo.forge.ocamlcore.org/API/Cairo.html#cairo_t
(about PDF: http://cairo.forge.ocamlcore.org/API/Cairo.PDF.html)
You may also want to check the tutorial
http://cairo.forge.ocamlcore.org/tutorial/
the code generating the figure being at
https://github.com/Chris00/ocaml-cairo
> ocamlopt -I +cairo -I +glMLite cairo.cmxa wander.ml -o wander
For reasons of better portability and easiness, you should use
ocamlfind ocamlopt -package cairo2 wander.ml -o wander
Hope it helps,
C.