incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Constenla-Haile <ariel.constenla.ha...@gmail.com>
Subject Re: odt2braille on the Mac
Date Fri, 28 Oct 2011 16:33:39 GMT
Hi Brett, *

On Fri, Oct 28, 2011 at 12:42:18PM +0200, Bert Frees wrote:
> Hello J├╝rgen and Ariel,
> 
> Thanks for your help. I appreciate you want to solve this MacOS issue when
> there is more time.
> 
> Ariel, the suggested code works :) I am now trying to find a way to send a
> byte stream to a printer. 

let me see if I get it: you are trying to print arbitrary stuff just
like in this java snippet
http://download.oracle.com/javase/6/docs/api/javax/print/PrintService.html


> Could XPrinterPropertySet.setBinarySetup be used
> for this purpose maybe? 

this method is for setting the Printer setup (that is, the printer
configuration), not for setting the data to be printed

> The com.sun.star.awt.XPrinter service only seems to
> support graphical data, am I right?

mmm I've only used this to get the printer name, and then print an OOo
document, via the css.view.XPrintable interface implemented by OOo 
documents. 
Printing in OOo is well supported for printing *office* documents (not 
any data you may want to print, let's say a PDF file, for example. If 
you want to print an arbitrary file, let's say a PNG picture, you have 
to import it as an OOo Draw document and print that office document;
AFAIK there is now away to then the PNG image directly to the printer
- and this is not wrong, OOo is an office suite, not a printing 
application).

On the other hand, looking at the code in
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/workben/controls.cxx?view=markup#l125
you are able to draw onto a virtual device and print it. See the
attached code, it is Java version of this C++ sample.

Unfortunately this does not work, there is a bug in the implementation:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/source/awt/vclxprinter.cxx?view=markup#l325
if ( mpListener.get() ) always evaluates to false, that shared pointer
has never been set before. For what I could understand there, it should
be:

if ( mpPrinter.get() )
{
    maInitJobSetup = mpPrinter->GetJobSetup();
    mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
}

this seems to "work"... well, the "Print" dialog shows up now, with the
text drawn onto the virtual device:
http://arielch.fedorapeople.org/images/vclxprinter.png

funny indeed.


In short, print office documents, using the well known interfaces
described in the view module
http://api.openoffice.org/docs/common/ref/com/sun/star/view/module-ix.html
http://api.openoffice.org/docs/common/ref/com/sun/star/view/XPrintable.html
http://api.openoffice.org/docs/common/ref/com/sun/star/view/XPrintable-xref.html
http://ooo-wiki.apache.org/wiki/Documentation/DevGuide/OfficeDev/Storing_Documents#Printing_Documents


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Mime
View raw message