Page 1 of 1

Questions about 19.1 Floating images

Posted: Fri Oct 13, 2017 10:41 am
by annetteb
Hello,
I've had a look at the new features of 19.1 and the possibility to define floating images seems great. But I haven't found much information about how it works.
I currently have custom plugins to generate PDF files in various formats. In all my plugins, I'm already using the outputclass on many images to make sure they have all the same width (and easily modify them if needed). As far as I know, the outputclass attribute is not multi-value attributes, so here are my questions:
- First, when using a custom plug-in (let's say with no outputclass defined on images), would the new feature work?
- When using a custom plug-in with outputclass already defined, what happens? Is it possible to keep both behaviors (the float behavior and the one defined in the custom plug-in)? Would there be a way to benefit from this feature or to somehow integrate it in my plug-in?
- Last but not least, how does it work if the image is in step>info>fig? How does the text wrap? I would expect the top of the floating image to be aligned with the content of the cmd element and a "clear" so that the following step does not wrap around the floating image of the previous step.
Thanks & regards,
Annette Bouillin

Re: Questions about 19.1 Floating images

Posted: Fri Oct 13, 2017 2:15 pm
by Radu
Hi Annette,

Please see some answers below:
As far as I know, the outputclass attribute is not multi-value attributes
The outputclass attribute receives a string value. How that value is interpreted is up to the XSLT processing.
So if you have outputclass="float-right auto-width" set on the image and the XSLT processing splits the value in tokens and recognizes each of the tokens, using their values, setting multiple values works.
- First, when using a custom plug-in (let's say with no outputclass defined on images), would the new feature work?
The floating capabilities are available as a DITA OT plugin. Besides bundling the plugin with Oxygen's bundled DITA Open Toolkit, it is also available as an open source plugin on GitHub:

https://github.com/oxygenxml/dita-image-float

As you see the XSLT for PDF output:

https://github.com/oxygenxml/dita-image ... stomFO.xsl

matches images for which the @outputclass attribute contains one of two values.
- When using a custom plug-in with outputclass already defined, what happens? Is it possible to keep both behaviors (the float behavior and the one defined in the custom plug-in)? Would there be a way to benefit from this feature or to somehow integrate it in my plug-in?
If your custom PDF plugin also matches the same xsl:template as ours, only one of the plugins will win. So you probably can enhance the XSLT code for your plugin to also do what our plugin does when looking at the @outputclass attribute value set on the image..
- Last but not least, how does it work if the image is in step>info>fig? How does the text wrap? I would expect the top of the floating image to be aligned with the content of the cmd element and a "clear" so that the following step does not wrap around the floating image of the previous step.
I have no idea but you can try and find out. The default PDF processor bundled with Oxygen (Apache FOP) does not have very good support for floating images, but I only testing floating an image inside a paragraph and it looked nice.
About the "clear" attribute somehow specified on other elements, we had a request about it:

https://github.com/oxygenxml/dita-image-float/issues/2

I did not implement it because the Apache FOP default processor does not have support for "clear".
The commercial ones (XEP, Antenna House) have it as far as I know.

Regards,
Radu

Re: Questions about 19.1 Floating images

Posted: Fri Oct 13, 2017 2:55 pm
by annetteb
Hi Radu,
Thanks for the details!
I'll test the feature and have a look at your code. I'm using XEP and made tests for floats in steps, but eventually did not use it. I'll dig a little to remember what I did and may post the code here if it is of interest for someone.
It's good to know that we can enter multiple values in the outputclass attribute, I'll try it!
Best regards,
Annette