[Gambas-user] Printing

Rob sourceforge-raindog2 at ...94...
Fri Mar 18 05:38:39 CET 2005


On Thursday 17 March 2005 20:35, Eric Damron wrote:
> However, for my own project I don't think this technique will work.
>  I do need to be able to format the document but I would prefer to
> allow the user to view the document first and then print it if
> he/she decides.

You could have a print button that clears the web browser control and 
repopulates it with the same data, adding that javascript onload 
event.... maybe you could even do input type=button with an inline 
style preventing it from showing up in the printed output, with an 
onclick of window.print().  I don't know if either of these things 
would work, but they're what I'd try.

> What are some of my printing options in Gambas?  Can I talk to Open
> Office?

Well, you can treat the Printer object as a big drawing object, first 
of all, but sure, you can write Open Office documents if you 
understand their format (bunch of XML files in a .jar file renamed to 
.sxw (or .sxc or whatever)) and can figure out gb.xml.* to generate 
them.

You could also do what I've been working on lately, writing a perl 
script that accepts data in a simple ascii format ("text 200 400 this 
is some text", etc.) and outputs an openoffice document, a pdf, or 
HTML with CSS.  When I'm comfortable with the code, I'll release it, 
but obviously I hope to see something like gb.xml.openoffice or 
gb.pdfwrite someday (I guess that would be a benefit to targeting 
Parrot eventually, as those bindings are already written for perl.)

Rob






More information about the User mailing list