CSS-PDF: Sizing images inside a table
Posted: Thu Jul 09, 2020 12:55 am
Using Oxygen 22, CSS-based PDF.
In my customization CSS, I have this rule, which works.
*[class ~= "table/image"] {
max-width: 1.5in;
}*/
Here's an example DITA where this works:
However, in some cases, I need to show 2 images inside a stepxmp. To do this, I create a 1-row table and put each image as a cell in the table. Here is the DITA:
On webhelp responsive, it looks like this: https://i.imgur.com/Gp37cC3.jpg
But in my PDF output, the max-size rule is not being applied in this case. See this: https://i.imgur.com/63Pej1f.jpg
I looked at the merged HTML file to see if images inside a table were given a different class attribute, but they seem the same.
Here is the merged HTML for an image NOT inside a table:
<img class="- topic/image image" href="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPFasteners.jpg" id="unique_5_Connect_42_image_a1y_bxg_rjb" nd:nd-id="image_a1y_bxg_rjb" placement="inline" src="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPFasteners.jpg">
And here is the merged HTML for an image that IS inside a table:
<img class="- topic/image image" href="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPHousing.jpg" id="unique_5_Connect_42_image_oyd_jxg_rjb" nd:nd-id="image_oyd_jxg_rjb" placement="inline" src="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPHousing.jpg">
I would expect BOTH of these to be caught by the topic/image CSS rule above. But something is off. Can anyone provide some guidance?
In my customization CSS, I have this rule, which works.
*[class ~= "table/image"] {
max-width: 1.5in;
}*/
Here's an example DITA where this works:
Code: Select all
<step id="JPlugFastenersX">
<cmd>Use a H15 bit to remove the 4 screws that secure the J-Plug housing.</cmd>
<info>
<note>Retain all removed fasteners. Each screw also is secured with a nut, a
split washer, and a flat washer.</note>
</info>
<stepxmp><image href="Images/TopLid/JPFasteners.jpg" id="image_a1y_bxg_rjb"
/></stepxmp>
</step>
Code: Select all
<step>
<cmd>Remove and discard the housing from the J-Plug. Position the J-Plug facing
up.</cmd>
<stepxmp>
<table
frame="all"
rowsep="1"
colsep="1"
id="table_wtv_3xg_rjb">
<tgroup
cols="2"
align="center">
<colspec
colname="c1"
colnum="1"
colwidth="1*"/>
<colspec
colname="c2"
colnum="2"
colwidth="1*"/>
<tbody>
<row>
<entry><image
href="Images/TopLid/JPHousing.jpg"
id="image_oyd_jxg_rjb"/></entry>
<entry><image
href="Images/TopLid/JHousing2.jpg"
id="image_z1k_jxg_rjb"/></entry>
</row>
</tbody>
</tgroup>
</table>
</stepxmp>
</step>
On webhelp responsive, it looks like this: https://i.imgur.com/Gp37cC3.jpg
But in my PDF output, the max-size rule is not being applied in this case. See this: https://i.imgur.com/63Pej1f.jpg
I looked at the merged HTML file to see if images inside a table were given a different class attribute, but they seem the same.
Here is the merged HTML for an image NOT inside a table:
<img class="- topic/image image" href="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPFasteners.jpg" id="unique_5_Connect_42_image_a1y_bxg_rjb" nd:nd-id="image_a1y_bxg_rjb" placement="inline" src="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPFasteners.jpg">
And here is the merged HTML for an image that IS inside a table:
<img class="- topic/image image" href="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPHousing.jpg" id="unique_5_Connect_42_image_oyd_jxg_rjb" nd:nd-id="image_oyd_jxg_rjb" placement="inline" src="file:/C:/GitDocs/ProductionRig/Images/TopLid/JPHousing.jpg">
I would expect BOTH of these to be caught by the topic/image CSS rule above. But something is off. Can anyone provide some guidance?