cairo pdf

Hendrik Boom <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
How do I manage to produce a pdf file.

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.

The example as is, does produce a nice triangle.png file, which I can 
view in a browser.  I've got that much working. But it's a pdf file I 
need.

The obvious
   open Cairo.pdf
and later
   Cairo_pdf.surface_write_to_file surface "triangle.png";

doesn't work.

Error: Unbound value Cairo_pdf.surface_write_to_file

Nor does it work if I replace 

   let surface = Cairo.image_surface_create Cairo.FORMAT_ARGB32 ~width 
~height in

by

  let pout =  (open_out_bin "triangle.pdf") in
  let surface = Cairo_pdf.surface_create_for_channel pout (float_of_int 
width) (float_of_int height) in

with at the end

  Cairo.surface_flush surface;
  close_out pout;

I use the following command line for this:

	ocamlopt -I +cairo -I +glMLite cairo.cmxa wander.ml -o wander

It compiles and runs, but creates an empty triangle.pdf file.

What is it I *do* have to do?  It's probably a trivial variation on the 
above, but I can't figure it out.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.