incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernand Vanrie <...@pmgroup.be>
Subject Re: [Rendering] Trying to render text page to a bitmap
Date Wed, 30 May 2012 10:08:14 GMT
On 30/05/2012 11:20, Erik Wigforss wrote:
> Hi,
>
> Thanks for the code but it doesn't work.
for you i suppose  :-)
>
> Heres my code to anser every question one will ever have about ooo.
>
> Sub TheAnswerForEveryting()
>
> If isDepressed() Then
>    doNothing()
> ElseIf isHappy() Then
>    doSomething()
> ElseIf isHatred() Then
>   crashForNoReason()
> ElseIf isPolite() Then
>    throwAnError()
> Else
>    waitForOneSecondAndTryAgain()
> End If
> End Sub
>
> Erik
>
> 2012/5/3 Fernand Vanrie<sos@pmgroup.be>
>
>> Erik ,
>> With BASIC it can been done
>> have a look at this thread<http://openoffice.2283327.n4.**
>> nabble.com/api-dev-Open-a-**file-with-standard-**application-from-dialog-*
>> *td3067760.html<http://openoffice.2283327.n4.nabble.com/api-dev-Open-a-file-with-standard-application-from-dialog-td3067760.html>
>> hope it helps
>>
>> Fernand
>>
>> Hi, I'm trying to render a page to a bitmap and I don't get it working.
>> Drawing primitives works but not render a document. Do anyone know how to
>> do this? Here is my code: public static BufferedImage makeThumb(File
>> inFile) throws IOException, BootstrapException, IllegalArgumentException,
>> Exception, java.io.IOException { XComponentLoader xCompLoader =
>> OfficeConnection.**getConnection().**getXComponentLoader();
>> PropertyValue[] loadProps = new PropertyValue[2]; loadProps[0] =
>> OfficeTools.makeProperty("**ReadOnly", Boolean.TRUE); loadProps[1] =
>> OfficeTools.makeProperty("**Hidden", Boolean.TRUE); XComponent xDoc =
>> xCompLoader.**loadComponentFromURL(**OfficeTools.makeOpenOfficeUrl(**inFile.getAbsolutePath()),
>> "_blank", 0, loadProps); XRenderable xRender = (XRenderable)UnoRuntime.**
>> queryInterface(XRenderable.**class, xDoc); if (xRender != null) {
>> System.out.println("Is Renderable"); XDevice xDevice = OfficeConnection.**
>> getConnection().getXToolkit().**createScreenCompatibleDevice(**1024,
>> 1024); PropertyValue[] renderProps = new PropertyValue[2]; renderProps[0] =
>> OfficeTools.makeProperty("**RenderDevive", xDevice); renderProps[1] =
>> OfficeTools.makeProperty("**PageRange", "1"); xRender.render(0, xDoc,
>> renderProps); XBitmap xBitmap = xDevice.createBitmap(0, 0, 1024, 1024); if
>> (xBitmap != null) return ImageIO.read(new ByteArrayInputStream(xBitmap.**getDIB()));
>> else System.out.println("No bitmap created!"); } else {
>> System.out.println("Not Renderable"); } return null; } Thanks in advance,
>> Erik Wigforss
>>
>>


Mime
View raw message