Gretyl's Portal

Heretto Help

Show Page Sections

Styling Annotated Images

In Heretto CCMS, you can add annotations, for example, callouts to images. Annotations can be globally styled in PDF Generator publishing scenarios according to your branding needs.

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 affect path 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.

  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. In the PDF Generator scenarios screen, click the publishing scenario you want to edit.
  3. In the CSS tab, add this code:
    /* Custom annotation border */
     figure svg g path {
        stroke: #545454 !important;
        stroke-width: 2px !important;
     }
  4. Click Save Scenario.

The annotation callout border is gray and its width is two pixels. You can modify the code to match your branding needs.

An exemplary product image with styled annotations

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.

  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. In the PDF Generator scenarios list, click the publishing scenario you want to edit.
  3. In the CSS tab, add the following code:
    /* Custom annotations fill color */
     figure svg g path {
         fill: #fae3d9 !important;
     }
  4. Click Save Scenario.

The background color of the annotation callout is light orange. You can modify the code to match your branding needs.

An exemplary product image with styled annotations

Style Annotation Callout Font

You can change the default font properties of the numbers in the annotation callouts with CSS.

  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. In the PDF Generator scenarios list, click the publishing scenario you want to edit.
  3. In the CSS tab, add the following code:
    /* Custom annotation font */
     figure svg g + text {
        fill: #e65f26 !important;
        font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
        font-weight: bold !important;
        font-size: 22px !important;
     }
  4. Click Save Scenario.

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 the color 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.

An exemplary product image with styled annotations

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

  1. In the Content Editor, open a topic with an annotated image you want to style.
  2. Click the Attributes tab in the right pane and from the Element drop-down menu, select Figure.
  3. Apply a meaningful value to the outputclass attribute.

    You will need the outputclass attribute value for your CSS.

Add CSS styling for the outputclass attribute

  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. In the PDF Generator scenarios list, click the publishing scenario you want to edit.
  3. In the CSS tab, paste this code and replace example-class with the outputclass attribute value you added to the figure.
    /* Custom annotations styling on specific images */
     figure.example-class svg g path {
        stroke: #545454 !important;
        stroke-width: 2px !important;
        fill: #eee !important;
     }
    This code combines a few changes. It modifies the:
    • border color
    • border width
    • background color
  4. Click Save Scenario.

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

You can style a specific annotation element like a callout. This is easier than modifying styling individually in the editor, because it enables you to easily change the appearance of selected annotation elements globally. Follow this procedure to style callouts and other annotation elements.

Apply a class attribute to an annotation element

  1. In the Content Editor, open a topic with an annotated image you want to style.
  2. Click the image, then click Annotate Image.
  3. In the Annotations interface, select the specific annotation that you want to highlight.
  4. In the class field, add a meaningful class attribute value.

    You will need the class attribute value for your CSS.

    Layer 1
  5. Save changes and by clicking Close.

Add CSS styling for the class attribute

  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. In the PDF Generator scenarios list, click the publishing scenario you want to edit.
  3. In the CSS tab, paste this code and replace main-annotation with the class attribute value you added to the annotation element.
    /* Custom styling on specific annotations */
     figure svg g.main-annotation path {
         stroke: #ff0000 !important;
         stroke-width: 4px !important;
     }
  4. Click Save Scenario.

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.

Styling applied only to the annotations with a specific class

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.

  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. In the PDF Generator scenarios list, click the publishing scenario you want to edit.
  3. In the CSS tab, add styling to .image, svg.
    /* Add image borders to image elements. */
    .image,
    svg {
        border: 5px solid #000;
    }
    

Styling is applied to annotated and non-annotated images. You can modify the code to match your branding needs.