Re: cairo pdf

Hendrik Boom <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
On Tue, Apr 22, 2014 at 05:35:24PM +0200, Christophe Troestler wrote:
> 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

Thank you.  This all looks good.  Unfortunately, when I try it I get

hendrik@notlookedfor:~/dv/fun/group$ ocamlfind ocamlopt -package cairo2 wander.ml -o wander
ocamlfind: Package `cairo2' not found

which is not surptising because I haven't *got* cairo2.  There does 
seem to be a cairo2-related package in Debian, but not an ocaml cairo2 
package.

It looks as if this solution will have to wait for tomorrow, when my 
deadline is past.  I've had similar issues with opengl about a year or 
so ago, when I used a different openGL binding from the one in Debian.
Then I had the time to get source and compile my own.

It looks as if, for today, I'll have to generate a .png, and print it 
from the browser, even though this produces unsharp, antialiased edges.
But I'll be able to finish development and get the output I need on 
time.  Improvements deferred until later, maybe tomorrow afternoon.

Unless there's a really fast, easy, foolproof way to install the 
necessary package, of course.

-- hendrik

> 
> 
> Hope it helps,
> C.
> 
> 
> ------------------------------------
> 
> Archives up to December 31, 2011 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners
> The archives of the very official ocaml list (the seniors' one) can be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo Groups Links
> 
> 
>
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.