Page 1 of 1

Changing delivered images and correcting their resolution

Posted: Thu Jan 03, 2013 2:17 am
by P4jjb
Hi there,

Looked in the help and these forums but didn't come across the answers to these questions. (Apologies I if missed them.)

I need to substitute new images for the delivered note, important, warning, and other delivered icons, and I also need to correct the resolution in the PDF.

1. Is the following directory where I store my substituted images? It's got various images/icons as .gif, .png, .svg, and .tif.

C:\Program Files\Oxygen XML Editor 14\frameworks\docbook\xsl\images

2. I'm creating DocBook 5 output in PDF and WebHelp. These note/important/warning images look good in the WebHelp but pixelated in the PDF. I've read the instructions in the Help topic "An Image appears stretched out in the PDF output" and edited the OXYGEN_INSTALL_DIR\lib\fop-config.xml. However, it's delivered with the recommended resolution value of 120 already set. And changing this value didn't correct the pixelation issue. Is there a way to correct this so the Apache processor outputs the correct resolution for PDF and WebHelp--is there another file I should modify?

Thanks!

Re: Changing delivered images and correcting their resolution

Posted: Thu Jan 03, 2013 10:21 am
by Radu
Hi,

Yes, the folder:

OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\images

contains all Docbook admonition graphics.

If you open this XSL:

OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/fo/admon.xsl

it has an XSLT template called:

Code: Select all

<xsl:template match="*" mode="admon.graphic.width">
<xsl:param name="node" select="."/>
<xsl:text>36pt</xsl:text>
</xsl:template>
which sets a static width of 36 points to all admonition graphics.
You could try to decrease that width to better suit the admonition images.

You already read the topic:

http://www.oxygenxml.com/doc/ug-oxygen/ ... utput.html

Right now, because of that XSLT template above, the first (1) option is chosen by the Apache FOP processor (because the image has in the XSL-FO file specified the width to be 36 points).

Regards,
Radu

Re: Changing delivered images and correcting their resolution

Posted: Sat Jan 05, 2013 5:01 am
by P4jjb
Thanks, Radu!
I tried different width values between 12-18pt.
Selected 16pt as the images looked good when the PDF zoom is at 100-150% (though the delivered Note image is quite light).

Should this value modification actually be on a customization layer? Or is this a case where the .XSL must directly modified?

Re: Changing delivered images and correcting their resolution

Posted: Sat Jan 05, 2013 5:09 am
by P4jjb
Creating this separate post for the admon images in DocBook 5 WebHelp.
As stated in my initial thread post, the WebHelp admon images look good (aren't pixelated).

I see I'll need to install my substitute admon images in this file:
OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\webhelp\docs\common\images\admon

But--where's the width control for WebHelp admon images? :?:
Don't see an admon.xsl for the WebHelp as there was for the PDF--though ../images/admon is coded in lines 620-622 of the following file:

OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\webhelp\xsl\webhelp-common.xsl

Re: Changing delivered images and correcting their resolution

Posted: Mon Jan 07, 2013 9:57 am
by Radu
Hi,
Should this value modification actually be on a customization layer? Or is this a case where the .XSL must directly modified?
There seems to be no XSLT parameter controlling this feature (and I do not understand why, maybe you should ask around on the Docbook Users list).
But you can overwrite the template in your own XSLT.
If you edit the Docbook to PDF transformation scenario, you will see Oxygen invokes the following XSLT:

OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/fo/docbook_custom.xsl

You can create your own XSLT which imports the one above and adds a template like:

Code: Select all

<xsl:template match="*" mode="admon.graphic.width">
<xsl:param name="node" select="."/>
<xsl:text>126t</xsl:text>
</xsl:template>
You can also add xsl:message's to see that your template gets called, they should appear in Oxygen's Messages tab after the transformation is over.

Regards,
Radu

Re: Changing delivered images and correcting their resolution

Posted: Mon Jan 07, 2013 10:17 am
by Radu
About admonitions for WebHelp:

There are two types of WebHelp outputs:

1) The WebHelp output delivered out of the box by the Docbook XSLs. The predefined transformation scenario for this in Oxygen is called DocBook WebHelp (old).
The specific XSLs for it can be found in:

OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\webhelp

2) Our own improved Docbook WebHelp (with support for search, index terms) The predefined transformation scenario for this in Oxygen is called DocBook WebHelp.
The specific XSLs for it can be found in:

OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\com.oxygenxml.webhelp

Both these transformations rely heavily on the Docbook to XHTML transformation so you should look (make changes) in this XSL:

OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/xhtml/admon.xsl

Regards,
Radu

Re: Changing delivered images and correcting their resolutio

Posted: Wed Jun 26, 2013 12:04 am
by P4jjb
Hi Radu,

Thanks for your response.
How do I set the WebHelp admon.graphics.extension parameter to a value of .svg?

If I look at the file you pointed to:
oXgen_install_dir/frameworks/docbook/xsl/xhtml/admon.xsl

Here's the code at lines 34-46:

Code: Select all

<xsl:template name="admon.graphic">
<xsl:param name="node" select="."/>
<xsl:value-of select="$admon.graphics.path"/>
<xsl:choose>
<xsl:when test="local-name($node)='note'">note</xsl:when>
<xsl:when test="local-name($node)='warning'">warning</xsl:when>
<xsl:when test="local-name($node)='caution'">caution</xsl:when>
<xsl:when test="local-name($node)='tip'">tip</xsl:when>
<xsl:when test="local-name($node)='important'">important</xsl:when>
<xsl:otherwise>note</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$admon.graphics.extension"/>
</xsl:template>
Do I need to create a custom WebHelp stylesheet with the following code:

Code: Select all

<xsl:template match="*" mode="admon.graphic">
<xsl:param name="admon.graphics.extension" select="'.svg'"/>
</xsl:template>

Re: Changing delivered images and correcting their resolutio

Posted: Thu Jun 27, 2013 11:39 am
by sorin_ristache
Hi,
P4jjb wrote:How do I set the WebHelp admon.graphics.extension parameter to a value of .svg?

...

Do I need to create a custom WebHelp stylesheet with the following code:
You don't have to customize an XSLT stylesheet. It would be enough to set the admon icon images in a CSS stylesheet that is already included in every Webhelp output page.

What Oxygen version do you use? In Oxygen 15.0 the Docbook admon icons for the Webhelp transformation are set in the CSS stylesheet [Oxygen-15.0-install-dir]\frameworks\docbook\xsl\com.oxygenxml.webhelp\oxygen-webhelp\resources\css\webhelp_topic.css so you have to modify this stylesheet and set SVG images as Docbook admon icons instead of the default ones (which are PNG images). Just look for tip.png, note.png, warning.png, etc in this stylesheet webhelp_topic.css.

Also you have to place the SVG image files in the directory [Oxygen-15.0-install-dir]\frameworks\docbook\xsl\com.oxygenxml.webhelp\oxygen-webhelp\resources\img, that is the files: note.svg, warning.svg, caution.svg, tip.svg, important.svg.

If you use an earlier version of Oxygen you could follow the same pattern as in Oxygen 15.0 for setting any admon icon images you want in the DocBook Webhelp output.


Regards,
Sorin