Page 1 of 1
Removing SVG icon in thead of hazardstatements in PDF
Posted: Tue Dec 10, 2024 10:38 am
by Sergio_7
Dear Oxygen team,
I would like to hide the little svg icon that always appears in the header of a hazard statement. I can use all css codes (see below), which works fine for HTML but not for
PDF. Could you please give me a hint on how to hide this icon for pdf output?
I have tried almost everything but it remained untouched. All these codes work for html, but not for pdf:
Code: Select all
.hazardstatement th svg {
display:none;
}
OR
Code: Select all
.hazardstatement thead tr th svg {
display:none;
}
OR
Code: Select all
.hazardstatement thead svg:first-of-type {
display:none;
}
Thank you in advance!
Best regards!
- svg-icon-in-th.PNG (4.48 KiB) Viewed 230 times
Re: Removing SVG icon in thead of hazardstatements
Posted: Tue Dec 10, 2024 11:42 am
by julien_lacour
Hello,
If you followed our
user guide topic you should just remove/comment the following property:
Code: Select all
/* Show logo in the header. */
*[othertype ~= "HIGH_VOLTAGE"] .hazardstatement--other::before {
padding: .5rem;
/*content: url("electricity_icon.svg");*/
}
Regards,
Julien
Re: Removing SVG icon in thead of hazardstatements
Posted: Tue Dec 10, 2024 1:59 pm
by Sergio_7
Hi Julien,
Thank you for your reply. I don't use customized symbols, I just want to remove the standard symbols that are always generated with types like “Warning”, “Caution” etc. All my efforts were unsuccessful with these attempts:
Code: Select all
.hazardstatement--warning::before {
display: none;
content: none;
}
Code: Select all
.hazardstatement_warning td:first-of-type {
display: none;
content: none;
}
Code: Select all
.hazardstatement td:first-of-type {
display: none;
content: none;
}
Code: Select all
.hazardstatement th:first-of-type {
display: none;
content: none;
}
Code: Select all
*[type ~= "warning"] .hazardsymbol {
display: none;
content: none;
}
Thanks!
- svg-icon-in-th.PNG (4.48 KiB) Viewed 233 times
Re: Removing SVG icon in thead of hazardstatements
Posted: Wed Dec 11, 2024 2:05 pm
by xephon
Sergio, there is a section named “ How to Remove the Hazard Symbol” in the linked topic.
Re: Removing SVG icon in thead of hazardstatements
Posted: Wed Dec 11, 2024 2:50 pm
by Sergio_7
- svg-icon-in-th.PNG (4.48 KiB) Viewed 214 times
Hi,
thanks for your reply. I have read the section and it is not working on my site.
Please check if this CSS code works correctly for
PDF to remove the small icon in the header of the warning before the “Warning” hazard statement:
Code: Select all
.hazardstatement_warning .hazardstatement--logo-col {
display: none;
}
.hazardstatement_warning th {
table-column-span: 1
}
.hazardstatement_warning td:first-of-type {
display: none;
}
Thanks!
Re: Removing SVG icon in thead of hazardstatements in PDF
Posted: Wed Dec 11, 2024 3:55 pm
by julien_lacour
Hello,
Currently this is only possible using an XSLT Extension Point:
- Create an XSLT stylesheet with the following content:
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:svg="http://www.w3.org/2000/svg"
exclude-result-prefixes="xs svg"
version="3.0">
<xsl:template match="tr[1]" mode="hazard-table">
<colgroup>
<col class="hazardstatement--logo-col"/>
<col class="hazardstatement--msg-col"/>
</colgroup>
<thead>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="#current"/>
</xsl:copy>
</thead>
</xsl:template>
<xsl:template match="svg:svg" mode="hazard-table">
<span class="hazardsymbol-container">
<xsl:copy-of select="."/>
</span>
</xsl:template>
</xsl:stylesheet>
- Declare the stylesheet as merged2html5 extension:
Code: Select all
<xslt>
<extension file="custom.xsl" id="com.oxygenxml.pdf.css.xsl.merged2html5"/>
</xslt>
- Hide the logo with the following CSS rule:
Code: Select all
.hazardsymbol-container {
display: none;
}
If you never did such customization you can check the following topics in our user-guide:
Regards,
Julien
Re: Removing SVG icon in thead of hazardstatements in PDF
Posted: Wed Dec 11, 2024 4:06 pm
by julien_lacour
Hello,
I added an improvement so that in Oxygen 27.1 you will just need to set the CSS, the symbol will be wrapped by default in the output.
I will notify this thread once the improvement will be available, if you do the update you will be able to remove the XSLT stylesheet from your publishing template and only keep the CSS.
Regards,
Julien