Re: [Gnome-print] Printing a Document with a Image from a file



Hello!

If your image is in file, it is most meaningful to use gdk-pixbuf API
(it comes from separate gdkpixbuf library):

#include <gdk-pixbuf/gdk-pixbuf.h>

...

GdkPixbuf *pb;

pb = gdk_pixbuf_new_from_file (filename);
gnome_print_pixbuf (pc,
                    gdk_pixbuf_get_pixels (pb),
                    gdk_pixbuf_get_width (pb),
                    gdk_pixbuf_get_height (pb),
                    gdk_pixbuf_get_rowstride (pb));
gdk_pixbuf_unref (pb);

But be cautious!!! Gnome-print (as does PostScript) renders all images
into (0,0 - 1,1) square in current user coordinates. So you have to
set up correct transformation, or everything you get is tiny dot
in (possibly unprintable) corner of page:

gnome_print_gsave (pc);
gnome_print_translate (pc, image_left_x, image_bottom_y);
gnome_print_scale (pc, image_width, image_height);
  /* Print your image/pixbuf here */
gnome_print_grestore (pc)

Btw: I just uploaded initial version webpage to 
http://www.gnome.org/projects/gnome-print/
It has many errors etc. but you can tak a look into FAQ there. I hope
to add much more information in coming weeks.

Best wishes,
Lauris Kaplinski

On 02 Aug 2001 14:46:45 +0100, Talus wrote:
> Hi once again i come to you can someone explain me how do i use this 
> functions?:
> 
> /* Images */
> 
> int gnome_print_grayimage (GnomePrintContext *pc, const char *data, int 
> width, int height, int rowstride);
> int gnome_print_rgbimage (GnomePrintContext *pc, const char *data, int 
> width, int height, int rowstride);
> int gnome_print_rgbaimage (GnomePrintContext *pc, const char *data, int 
> width, int height, int rowstride);
> int gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf);
> 
> I have the grid draw thank you very much. But i do need to insert a Logo 
> in the document from a Image file can someone help me on that?
> 
> Thank you Very Much to All of you
> 
> 
> _______________________________________________
> Gnome-print maillist  -  Gnome-print@ximian.com
> http://lists.ximian.com/mailman/listinfo/gnome-print






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]