Hi Alessandro, *,

On Sun, Feb 11, 2007 at 02:17:23PM +0100, Alessandro Zummo wrote:
> On Sat, 10 Feb 2007 09:55:03 +0100
> Christian Lohmaier <[EMAIL PROTECTED]> wrote:
> [...]
> > Basically the tough thing is embedding the generated graphic into the
> > document.
> 
>  yep, I noticed that ;) 
> 
> > I was having trouble with this as well, but got around it using an idea
> > from Danny Brewer (using the BitmapTable to get the graphic into the
> > container):
> > http://codesnippets.services.openoffice.org/Writer/Writer.EmbedAGraphicIntoATextdocument.snip
> 
>  I guess this would work, but would also require having a web server
>  to generate the image. looks ugly ;(

I think you misunderstool the URL-part. That doesn't mean that you need
a webserver. OOo uses URLs for "everything", a local file is
file:///tmp/somedir/some.file on linux for example (or
file:///c:/tmp/somfile.txt on windows)

THe routine I wrote expects a OOo-suitable URL for convenience. Java's
file-routines give you a "file:/tmp/foo.bar" only when you query for the
name in URL-notation.
The Graphic-Info property I used in the snippet looks like this:
(note that I use double here instead of the int OOo expects, it is just
convenience since barcode4j uses double)

    private static class GraphicInfo {
        /**
         * a UNO-style URL to the graphic (file:///tmp/path/foo.ext)
         */
        String unoURL;
        /**
         * the height of the graphic in 1/100 mm
         */
        double heightOfGraphic;
        /**
         *  the width of the graphic in 1/100 mm
         */
        double widthOfGraphic;
    }


You can use the ExternalUriReferenceTranslator service to convert an "external"
file-URL to an internal one (the file:///dir/otherdir/file.ext) notation:

file:///opt/openoffice.org2.1_sdk/docs/common/ref/com/sun/star/uri/ExternalUriReferenceTranslator.html
http://api.openoffice.org/docs/common/ref/com/sun/star/uri/ExternalUriReferenceTranslator.html

So when you read "URL", that doesn't imply "web/internet" :-)

ciao
Christian
-- 
NP: Samael - To Our Martyrs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to