Problems with custom CSS image borders for PDF HTML5&CSS output
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 4
- Joined: Fri Oct 06, 2023 2:54 pm
Problems with custom CSS image borders for PDF HTML5&CSS output
Hi there! I am using a PDF transformation style that I've downloaded from https://styles.oxygenxml.com/ for my DITA content.
I am trying to add a black border to all images via a custom CSS file that I reference in the Parameters tab during the transformation.
This is the only thing I have in that custom CSS:
The border appears, but it doesn't apply correctly in the PDF output.
For images narrower than the width of the page, it creates a border that is as wide as the page, filling the top, right, and bottom sides between the border and the image with empty white space as if some sort of padding.
Here's an example: https://imgur.com/94S2nJf
If I specify the width for the image in its attributes, the border applies correctly to the sides with almost no space, but the top and the bottom of the image still get white padding: https://imgur.com/a/irNLkWV
If I specify the height for the image, it only removes the white space at the bottom. https://imgur.com/a/BpnkumA
Inspecting it closely, it actually looks like the image is offset down in relation to its border, overlapping it at the bottom.
So, when I specify the height and width simultaneously, it still leaves a 1px white padding at the top while going a bit over the border at the bottom.
On top of that, I cannot reproduce and debug that behavior with the .merged.html file from the same output because the border applies without any issues there - the issue appears only in the pdf file from the same output.
I am trying to add a black border to all images via a custom CSS file that I reference in the Parameters tab during the transformation.
This is the only thing I have in that custom CSS:
Code: Select all
*[class ~= "topic/image"] {
border: 1px black solid;
}
For images narrower than the width of the page, it creates a border that is as wide as the page, filling the top, right, and bottom sides between the border and the image with empty white space as if some sort of padding.
Here's an example: https://imgur.com/94S2nJf
If I specify the width for the image in its attributes, the border applies correctly to the sides with almost no space, but the top and the bottom of the image still get white padding: https://imgur.com/a/irNLkWV
If I specify the height for the image, it only removes the white space at the bottom. https://imgur.com/a/BpnkumA
Inspecting it closely, it actually looks like the image is offset down in relation to its border, overlapping it at the bottom.
So, when I specify the height and width simultaneously, it still leaves a 1px white padding at the top while going a bit over the border at the bottom.
On top of that, I cannot reproduce and debug that behavior with the .merged.html file from the same output because the border applies without any issues there - the issue appears only in the pdf file from the same output.
-
- Posts: 39
- Joined: Mon Jul 25, 2022 11:18 am
Re: Problems with custom CSS image borders for PDF HTML5&CSS output
Post by andrei_pomacu »
Hi,
I could not reproduce your problem using Oxygen 25.1, in Windows.
Could you tell me which Oxygen version are you using?
Regards,
Andrei
I could not reproduce your problem using Oxygen 25.1, in Windows.
Could you tell me which Oxygen version are you using?
Regards,
Andrei
-
- Posts: 39
- Joined: Mon Jul 25, 2022 11:18 am
Re: Problems with custom CSS image borders for PDF HTML5&CSS output
Post by andrei_pomacu »
Hi,
The problem is that the image if is placed in a figure element, will inherit line-height from other elements.
If you set the line-height to 0 it should work.
Regards,
Andrei
The problem is that the image if is placed in a figure element, will inherit line-height from other elements.
If you set the line-height to 0 it should work.
Code: Select all
*[class ~= "topic/image"] {
border: 1px black solid;
line-height: 0;
font-size: 0;
}
Andrei
-
- Posts: 4
- Joined: Fri Oct 06, 2023 2:54 pm
Re: Problems with custom CSS image borders for PDF HTML5&CSS output
Thanks, that fixed the issue with the height. But the problem with the width being a full page on the PDF output remains...
If I put the image under a figure tag, the same thing happens, but just in the bounds of the figure instead of the full page width.
If I put the image under a figure tag, the same thing happens, but just in the bounds of the figure instead of the full page width.
-
- Posts: 39
- Joined: Mon Jul 25, 2022 11:18 am
Re: Problems with custom CSS image borders for PDF HTML5&CSS output
Post by andrei_pomacu »
Hi,
This problem could occur because you have placement=break on your images.
Please, remove this attribute from your images. It should not change the position of your figures in the documentation.
Regards,
Andrei
This problem could occur because you have placement=break on your images.
Please, remove this attribute from your images. It should not change the position of your figures in the documentation.
Regards,
Andrei
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service