English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
lablgtk and pdf
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-12-01 (15:48)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] lablgtk and pdf
On Tue, Dec 01, 2009 at 02:09:27AM +0000, Ewen Maclean wrote:
> I am generating pdf images from latex source, and I would like to
> show them on screen in part of a pane in lablgtk2. Is it possible to
> do this using a GImage widget or something similar?

I think you will have to render the PDF first into a simple image
format like PPM, and then use GTK to display that.  I don't know of
any OCaml bindings for libpoppler, but you can use the standalone
program "pdftoppm" from the poppler-utils package.  Then you can
display the .ppm file as follows:

    let file = Sys.argv.(1) in
    GMain.init ();
    let window = GWindow.window ~title: "Show Image" () in
    let image = GMisc.image ~file ~packing: window#add () in
    window#connect#destroy ~callback: GMain.quit;
    window#show ();
    GMain.main ()