gtk_print




On Thu, Aug 21, 2008 at 11:44 PM, Chris Vine <chris cvine freeserve co uk>
wrote:
    No, you are not missing anything obvious.  Doing it "in the ordinary
    way" means I think writing your own postscript interpreter for
    writing the pages to the cairo surface via pango.

    It will be hard work, but looking at the evince and poppler source may
    give you some ideas.  Poppler would probably lighten the load if you
    were to convert the file to PDF format.

    You do not explain why you want to print a postscript file under
    windows in the first place, but unless you have a special need I
    strongly suspect this approach will not be worth the effort. I do not
    use windows, but I believe there are some command-line tools available
    for printing postscript (via ghostscript, which has been ported to
    windows, for non-postscript printers) which might be suitable for your
    purposes.

    Chris

The reason I have a PS file in the first place is historical.  Back when I
originally wrote my plotting program, it was v2.4 of GTK+, thus, no Cairo,
and no GtkPrint.

To print, then, I plot my image internally, convert to a pixbuf, read the
pixel data and output this to a postscript file, i.e., it's an image I'm
plotting, with a little bit of text thrown in.

I realize that with the advent of Cairo and GtkPrint, this solution is
dated.  However, in order to convert to the current standard, I would need
to modify all of my gdk_* drawing calls to Cairo equivalents (and a little
re-architecting), not something I currently have the luxury to do.

What I was wanting to do, then, was to take advantage of the new GtkPrint
dialog (specifically, that it knows about all printers, allowing the user
to select one) and send this internally generated PS file directly to the
selected printer.

On a different note, a question:  One trick I employ when creating the PS
file is to plot my image in memory twice as large as the screen, save this
to the PS file, and then let the printer re-scale to fit the page.  Since
printers (typically) have a better resolution than a screen, this results
in a plot that is very sharp, (better than what the user sees on the
screen even).

When, one day, I do change all my gdk_* drawing calls to Cairo, will I be
able to effectuate this extra sharpness as well?  Or must the Cairo calls
in my GtkPrint callback conform to the paper size?  Or, is this not a
concern, i.e., the resulting printed image using Cairo would be as sharp
as possible given that Cairo takes into account the available dpi of the
selected printer?

Thanks for the feedback.  At this point I will have to recommend to my
users that a 3rd party program be used to send the PS file I create to a
printer.  (There is a nice free-ware version of this functionality
available, btw.)  Essentially making them have to engage in a 2-step
process to get a print out of my program instead of through a single step.

richard



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