[Gambas-user] Printing from GTK

Daniel Campos dcamposf at ...626...
Sat Apr 5 12:44:11 CEST 2008


Hi:

Thanks for the contribution. Anyway this mailing list uses to be
polite, I rarely read "you idiot" and things like that, usual on other
mailing lists :-)

>
>   SHELL "htmldoc --bodyfont Sans --outfile /home/c/Documents/tfc.pdf
>  --webpage /home/c/Documents/tfc.htm" WAIT
>   SHELL "lpr /home/c/Documents/tfc.pdf" WAIT
>
>  END

I never used "htmldoc", but if it is able to send data to stdout
instead of a file, you can write this for the first step:

DIM Buffer AS STRING
...
Buffer=SHELL "htmldoc --whatever-to-stdout"

That way SHELL will wait until htmldoc finishes, and it will put the
contents of its stdout to your Buffer

Then for the second command you can set lpr to work receiving from
stdin, and write the contents of your buffer, and then close that
stream

DIM hProc AS Process
...
hProc=SHELL "lpr --whatever-from-stdin" FOR WRITE
WRITE #hProc, Buffer,Len(Buffer)
CLOSE #hProc

I think that should work and avoid the need for a temporal file,
provided that both comand line tools can work with stdin/stdout.

Daniel




More information about the User mailing list