How to change image size in Pdf transform?
Posted: Tue Oct 25, 2016 6:45 pm
Hi,
I am trying to do the following with images sizes:
- reduce the image size to 50% for PDF transform
- apply scalefit for webhelp transform
My DITA code is as follows;
and the related code in my custom PDF plugin file C:\Program Files (x86)\Oxygen XML Author 18\frameworks\dita\DITA-OT2.x\plugins\com.example.print-pdf\xsl\fo\commons.xsl looks as follows:
None of the xsl tests seem to be applying for the PDF transform and my images are appearing full size.
Can anyone see what's wrong with this?
Thanks in advance,
Ann
I am trying to do the following with images sizes:
- reduce the image size to 50% for PDF transform
- apply scalefit for webhelp transform
My DITA code is as follows;
Code: Select all
<step>
<cmd>Select an Occupied Properties - <ph
conref="../../../../../t_content_refs.dita#t_content_refs/evic_init_task"/>
task from the property task summary that is in status <i>Open</i> .</cmd>
<info><image href="images/i_eviction_initated_open.png" scalefit="yes"/>
</info>
</step>
<step>
<cmd><ph
conref="../../../../../t_content_refs.dita#t_content_refs/select_cancel_action"
/></cmd>
<info><image href="images/i_eviction_cancelled.png" scalefit="yes"/></info>
</step>
Code: Select all
<fo:external-graphic src="url('{$href}')" xsl:use-attribute-sets="image">
<!--Setting image height if defined-->
<xsl:if test="$height">
<xsl:attribute name="content-height">
<!--The following test was commented out because most people found the behavior
surprising. It used to force images with a number specified for the dimensions
*but no units* to act as a measure of pixels, *if* you were printing at 72 DPI.
Uncomment if you really want it. -->
<xsl:choose>
<!--xsl:when test="not(string(number($height)) = 'NaN')">
<xsl:value-of select="concat($height div 72,'in')"/>
</xsl:when-->
<xsl:when test="not(string(number($height)) = 'NaN')">
<xsl:value-of select="concat($height, 'px')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$height"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<!--Setting image width if defined-->
<xsl:if test="$width">
<xsl:attribute name="content-width">
<xsl:choose>
<!--xsl:when test="not(string(number($width)) = 'NaN')">
<xsl:value-of select="concat($width div 72,'in')"/>
</xsl:when-->
<xsl:when test="not(string(number($width)) = 'NaN')">
<xsl:value-of select="concat($width, 'px')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$width"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:if test="not($width) and not($height) and not(@scale)">
<xsl:attribute name="content-width">
<xsl:value-of select="'50%'"/>
</xsl:attribute>
<xsl:attribute name="content-height">
<xsl:value-of select="'50%'"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@scalefit = 'yes' and not($width) and not($height) and not(@scale)">
<xsl:attribute name="width"> <xsl:value-of select="'50%'"/></xsl:attribute>
<xsl:attribute name="height"> <xsl:value-of select="'50%'"/></xsl:attribute>
<xsl:attribute name="content-width"> <xsl:value-of select="'50%'"/></xsl:attribute>
<xsl:attribute name="content-height"> <xsl:value-of select="'50%'"/></xsl:attribute>
<xsl:attribute name="scaling">uniform</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="node() except (text(),
*[contains(@class, ' topic/alt ') or
contains(@class, ' topic/longdescref ')])"/>
</fo:external-graphic>
Can anyone see what's wrong with this?
Thanks in advance,
Ann