poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51351] New Doc to FO extractor
Date Thu, 16 Jun 2011 08:03:03 GMT

--- Comment #11 from Yegor Kozlov <yegor@dinom.ru> 2011-06-16 08:03:03 UTC ---
> Graphic handling won't be part of extractor code. It's a lot of additional code
> AND additional libraries like Apache Batik or even ImageMagic calls. Also file
> creation and cleaning up should be coded.
> So there is an empty processImage() method that should be implemented in
> subclass if anyone want image to be included in XSL FO. createExternalGraphic()
> and setImageProperties() are helper methods for those people.

I see, but we can provide default support for png/jpeg with minimum efforts! I
added the following code and it worked for me:

    protected void processImage(Element currentBlock, boolean inlined,
            Picture picture) {

        byte[] bytes = picture.getContent();
        String ext = picture.getMimeType();
        if(ext.equals("image/jpeg") || ext.equals("image/png")){
            File file = new File(picture.suggestFullFileName()); 

            try {
                // dump images in the work dir 
                FileOutputStream out = new FileOutputStream(file);

                Element graphics =
                WordToFoUtils.setPictureProperties(picture, graphics);

            } catch (IOException e){


I agree that handling other mimetypes is not trivial and may involve
third-party libraries, but jpeg and png are most commons and should be
supported by default.

Does it make sense for you?


Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message