Styling Annotated Images
Facts and Recommendations
- Annotations and DITA-OT
Publishing annotated images is not supported by the DITA Open Toolkit (DITA-OT) publishing engine. It is supported by PDF Generator.
- Annotations and SVGs
Adding annotations to an image places the image element in an svg-container element and therefore makes it a Scalable Vector Graphic (SVG). Thanks to that you can add annotations over the image without modifying the image itself. This enables you to reuse the original, non-annotated image elsewhere.
- Annotations and the figure element
Typically, you annotate larger images. We recommend using the figure element for larger images. Our CSS styling examples are prepared with respect to that recommendation.
- Gray and Color publishing templates
PDF Generator comes with two default publishing templates, Gray and Color. They are complete and modular styles that you can leverage to quickly create your own PDF Generator templates. Our CSS styling examples are prepared with the assumption that your publishing scenarios are based on the Gray and Color templates.
- Annotation elements in XML
Annotation elements like callouts are represented by
path
elements in the XML. Your CSS customizations will affectpath
elements created in the SVG Editor, specifically the ones created with the SVG Editor Path or Pencil tool.- CSS
!important
property To overwrite the default styling of annotated elements in the default PDF Generator Gray and Color publishing scenarios, you need to use the
!important
CSS property.- What CSS styling affects
CSS styling applied to your PDF Generator publishing scenarios is reflected in output and the PDF Generator Preview mode. That styling does not affect the look of elements in the Content Editor.
Style Annotation Callout Borders
You can change the default color and width of annotation callout borders with CSS. As a result, all annotation callouts are styled consistently in the output and there is no need to style them individually in the SVG Editor. Follow this procedure to style callouts and other annotation elements.
The annotation callout border is gray and its width is two pixels. You can modify the code to match your branding needs.
Style Annotation Callout Background
You can change the default white background color of your annotation callouts with CSS. Follow this procedure to style callouts and other annotation elements.
The background color of the annotation callout is light orange. You can modify the code to match your branding needs.
Style Annotation Callout Font
You can change the default font properties of the numbers in the annotation callouts with CSS.
Annotations callouts are now in red and in bold. You can modify the code to match your branding needs.
-
Note that in this case, the
fill
property is responsible for the font color, not thecolor
property. -
Remember that changing the font size may result in numbers not aligned with the callout. This calls for additional styling with CSS.
-
This styling does not impact text fields introduced with the Text Tool in the editor.
Apply Styling to Specific Annotated Images Only
Instead of imposing global styling on all annotated images, you may want to apply different styling to different groups of annotated images.
Apply an outputclass attribute value to an annotated figure
Add CSS styling for the outputclass attribute
Annotated images with the defined outputclass attribute value added to the figure element are styled according to the CSS code. You can modify the code to match your branding needs.
Apply Styling to Specific Annotation Elements Only
Apply a class attribute to an annotation element
Add CSS styling for the class attribute
Annotation elements with the defined class attribute value are styled according to the CSS code. You can modify the code to match your branding needs.
Apply Styling to Both Regular and Annotated Images
You can apply the same CSS styling to images that are and are not annotated.
Adding annotations to an image automatically places the image element in an svg-container element and therefore makes it a Scalable Vector Graphics (SVG). SVGs and other image formats have the same styling applied to them in the default Color and Gray publishing templates.
Styling is applied to annotated and non-annotated images. You can modify the code to match your branding needs.