[Gnome-print] Can't print TIFF file from GdkPixbuf?



I've got some code I'm working on printing fine from .pnm files, but
for some reason it won't work for .tiff files.  It prints them, but
they look horrible; the text contained in the images is blocky and
unreadable.

I've written a simplified test case program, which demonstrates both
the problem with TIFF files, and the non-problem with PNM files.

I've attached the program, since it's only 38 lines long.  It can be
compiled with:

    gcc `gnome-config --cflags --libs print` tiffprint.c -o tiffprint

It can be run with

    ./tiffprint filename.tiff
    ./tiffprint filename.pnm

The TIFF and PNM files are both generated with GhostScript:

  gs -dNOPAUSE -dBATCH -r300 -sDEVICE=tiffg32d -sOutputFile=/tmp/test.%d.tiff 1040rpg1.pdf
  gs -dNOPAUSE -dBATCH -r300 -sDEVICE=pnm -sOutputFile=/tmp/test.%d.tiff 1040rpg1.pnm

Both of these images can be viewed on the screen in ee, and in my own
program, which uses a GnomePixbuf to display it.

Any ideas?

Thanks,

-----ScottG.
#include <stdlib.h>
#include <gdk/gdk.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-dialog.h>

int main(int argc, char *argv[])
{
  GnomePrinter *printer;
  GnomePrintContext *pc;
  GdkPixbuf *pixbuf;
  float h = 11.0, w = 8.5;

  gnome_init("tiffprint","0.0",argc,argv);
  
  printer = gnome_printer_dialog_new_modal();
  if (!printer)
    return;
  pc = gnome_print_context_new_with_paper_size(printer,"US-Letter");

  gnome_print_beginpage(pc, "Form");

  if (!(pixbuf = gdk_pixbuf_new_from_file(argv[1])))
  {
    printf("Couldn't load pixmap '%s'!\n",argv[1]);
    exit(1);
  }

  gnome_print_moveto(pc,0,h*72.0);
  gnome_print_gsave(pc);
  gnome_print_scale(pc, w*72.0, h*72.0);
  gnome_print_rotate(pc, 0.0);
  gnome_print_pixbuf(pc, pixbuf);
  gnome_print_grestore(pc);

  gnome_print_showpage(pc);
  gnome_print_context_close(pc);
}


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