Windows printing problem



Hi,

I have an app that prints 2 pages with an image in one corner of the
page, and some plotted data in the middle, the rest is text.

The page is oriented in landscape.

On Ubuntu the printing works fine.

On Windows XP I can get the text only to work.

Printing the image creates blank pages.

Printing the plotted data causes printing errors.

I'm using gtk+-bundle_2.18.7-20100213_win32

Any clues?

Code below.

Regards,
James.

        pb = gdk_pixbuf_new_from_file("./Logo.jpg", &gerror);
        if(!pb) {
                eprintf("error message: %s\n", gerror->message);
                return;
        }

        int pb_width = gdk_pixbuf_get_width (pb);
        int pb_height = gdk_pixbuf_get_height (pb);

//set to 1 makes the whole page blank on Win32, Linux fine.
#if 0
        cairo_surface_t *image = cairo_image_surface_create_for_data(
                                        gdk_pixbuf_get_pixels(pb),
                                        CAIRO_FORMAT_RGB24,
                                        pb_width,
                                        pb_height,
                                        gdk_pixbuf_get_rowstride(pb));

        do {
                int rowstride, n_channels, x, y;
                guchar *pixels, *p, tmp;

                pixels = gdk_pixbuf_get_pixels (pb);
                rowstride = gdk_pixbuf_get_rowstride(pb);
                n_channels = gdk_pixbuf_get_n_channels (pb);

                for (y = 0; y < pb_height; y++) {
                        for (x = 0; x < pb_width; x++) {
                                p = pixels + y * rowstride + x *
n_channels;
                                tmp = p[0];
                                p[0] = p[2];
                                p[2] = tmp;
                        }
                }
        } while (0);

        cairo_save (cr);
        cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
        cairo_set_source_surface(cr, image, 0, 0);
        cairo_paint (cr);

        cairo_restore (cr);


        cairo_surface_destroy(image);
#endif






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