Re: gtk_print



On Thu, 21 Aug 2008 13:07:15 +0200 (CEST)
"Richard Boaz" <riboaz xs4all nl> wrote:
> On Tue, Aug 19, 2008 at 3:41 PM, Chris Vine
> <chris cvine freeserve co uk> wrote:
> 
>     On Tue, 19 Aug 2008 10:47:54 +0200 (CEST)
>     "Richard Boaz" <riboaz xs4all nl> wrote:
> 
>     > Hi,
>     >
>     > The documentation for gtk_print states that once the user is
>     > finished with gtk_print_operation_run(), the "::draw-page"
>     > signal will be emitted. This signal is then to be caught by the
>     > program, using Cairo to render to the GtkPrintContext.
>     >
>     > Except that I have a Postscript file that needs to be sent to
>     > the printer.
>     >
>     > Does this mean that I cannot use the GtkPrint functionality?;
>     > specifically, the dialog showing the available printers and
>     > allowing the user to select one of them to send the Postscript
>     > file to?
> 
>     or if you are using Unix you could use the
>     GtkPrintJob/GtkPrintUnixDialog interface to send the postscript
> file directly to the underlying print system (cups or lpr) - see
>     gtk_print_job_set_source_file().
> 
> Unfortunately, this needs to work on W32 platform as well, so the
> UNIX-specific solution won't work for me.
> 
>     You can draw the postscript file to the cairo surface in the
> ordinary way using GtkPrintOperation,
> 
> I'm confused.  The example for the draw-page signal renders to the
> cairo print context using cairo commands.  How do I take a postscript
> file and "draw" it to this cairo print context (in the ordinary way)?
> 
> I've looked at the GTK+ and Cairo documentation and see only functions
> that are uni-directional, i.e., Cairo -> Postscript.  Are there
> functions that go the other direction, PS -> Cairo?
> 
> Or am I missing something completely obvious?

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



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