Loading ...
Sorry, an error occurred while loading the content.

14042cairo pdf

Expand Messages
  • Hendrik Boom
    Apr 22, 2014
    • 0 Attachment
      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

      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


      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.
    • Show all 6 messages in this topic