[Gnome-print] Problem printing pixbuf



I'm new to gimp-print, so please forgive me if this is a silly
question.  :)

I'm working on a program that basically takes an existing image (a
.pnm file in PBM format), writes some text on it at particular
coordinates, and then prints the whole shebang.  I've got the text
rendering correctly, it looks like, but I'm having no luck getting the
pixbuf to render.  Instead, it doesn't shows up at all in either the
print-previewer or the PostScript file I output.

The pixbuf is large (300dpi at a full-printing-page size, so 2550x3300
pixels) and black-and-white (PBM type P4).  When I ask gnome-print to
render it, the file seems appropriately large (about 51M); when I just
render the text, the file is much smaller (a few K).  Additionally,
I'm able to get parts of the image to show up on my page by playing
with the numbers in the transformation matrix argument to colorimage.

The pixbuf displays fine on-screen, in a GnomePixmap loaded with:

  gnome_pixmap_load_file (GNOME_PIXMAP (pixmap1), pixmap1_filename);

All of this leads me to believe that the problem is in the PostScript
arguments to colorimage.  Unfortunately, I don't know nearly enough
about PostScript to do anything about that.  :)

The pixmap is 2550x3300 pixels at 300dpi, so should render to exactly
8.5x11 inches, or 612x792 PostScript units (1/72 inch).  Here's a
snippet of the postscript that's being output:

[ ... ]
0 0 m
/buf 7650 string def
2550 3300 8
[ 2550 0 0 -3300 0 3300 ]
{ currentfile buf readhexstring pop }
false 3 colorimage
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
[ ... ]

In the hex data for the colorimage, I see enough 00's further down the
file to know there should be at least some black in there.  The file
is about 51MB.

Here's my code to render the pixbuf from the window it's displayed in:

  window_pixmap = (GdkPixmap *)(GNOME_PIXMAP(d)->pixmap);
  printf("Base pixmap is at %p\n",  window_pixmap);
  
  gdk_window_get_geometry(window_pixmap, &i, &i, &w, &h, &i);

  colormap = gtk_widget_get_colormap(GTK_WIDGET(d));
  printf("Colormap: %p\n", colormap);
  pixbuf = gdk_pixbuf_get_from_drawable(NULL, window_pixmap, colormap,
                                        0, 0, 0, 0, w, h);
  
/*    if (!(pixbuf = gdk_pixbuf_new_from_file(pixmap1_filename))) */
/*    { */
/*      printf("Couldn't load pixmap '%s'!\n",pixmap1_filename); */
/*      return; */
/*    } */
  
  gnome_print_moveto(pc,0,h*72.0/300.0);
  gnome_print_pixbuf(pc, pixbuf);
                                        
  printf("Pixmap is %dx%d\n",w,h);

It outputs:

  Base pixmap is at 0x8085098
  Colormap: 0x80843e0
  Pixmap is 2550x3300

I also tried the above commented-out code to read the image again from
the same file it was read from originally, with similar results.

Any ideas?  I've been working on this all day, and am completely
stumped.  This is with gnome-print 0.25, gnome-libs 1.2.11 GTK+ 1.2.8,
glib 1.2.8, gdk-pixbuf version 0.9.0.

Thanks,

------ScottG.






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