Class HtmlProcessingUtil


  • public class HtmlProcessingUtil
    extends Object
    • Constructor Detail

      • HtmlProcessingUtil

        public HtmlProcessingUtil()
    • Method Detail

      • replaceImageWithPlaceholder

        public static void replaceImageWithPlaceholder​(org.w3c.dom.html2.HTMLImageElement element,
                                                       StreamDescriptor descriptor)
        Replaces an image element that has a valid src attribute with a placeholder element.
        Parameters:
        element - image element with valid src attribute.
        descriptor - used for extracting a placeholder text.
      • replaceImageWithPlaceholderAndAddStreamToUnused

        public static void replaceImageWithPlaceholderAndAddStreamToUnused​(StreamResolver r,
                                                                           org.w3c.dom.html2.HTMLImageElement htmlImageElement)
      • fitBounds

        public static Dimension2D fitBounds​(Dimension2D sourceSize,
                                            Dimension2D maxSize)
        This method calculates the scaled bounds depending on the available maximum image bounds defined by maxSize.
        Parameters:
        sourceSize - the original dimensions.
        maxSize - the available space dimensions.
        Returns:
        the recalculated bounds.