Class SvgImageXObject


  • public class SvgImageXObject
    extends PdfFormXObject
    A wrapper for Form XObject for SVG images.
    • Field Detail

      • isGenerated

        private boolean isGenerated
      • isCreatedByImg

        private boolean isCreatedByImg
      • isCreatedByObject

        private boolean isCreatedByObject
      • em

        private float em
      • isRelativeSized

        private boolean isRelativeSized
    • Constructor Detail

      • SvgImageXObject

        public SvgImageXObject​(Rectangle bBox,
                               ISvgProcessorResult result,
                               ResourceResolver resourceResolver)
        Creates a new instance of Form XObject for the SVG image.
        Parameters:
        bBox - the form XObject’s bounding box.
        result - processor result containing the SVG information.
        resourceResolver - ResourceResolver for the SVG image.
      • SvgImageXObject

        public SvgImageXObject​(ISvgProcessorResult result,
                               SvgDrawContext svgContext,
                               float em,
                               PdfDocument pdfDocument)
        Creates a new instance of Form XObject for the relative sized SVG image.
        Parameters:
        result - processor result containing the SVG information
        svgContext - the svg draw context
        em - em value in pt
        pdfDocument - pdf that shall contain the SVG image, can be null
    • Method Detail

      • setIsCreatedByImg

        public void setIsCreatedByImg​(boolean isCreatedByImg)
        Set if SVG image is created from HTML img tag context
        Parameters:
        isCreatedByImg - true if object is created from HTML img tag, false otherwise
      • isCreatedByImg

        public boolean isCreatedByImg()
        Check if SVG image is created from HTML img tag context
        Returns:
        true if object is created from HTML img tag, false otherwise
      • setIsCreatedByObject

        public void setIsCreatedByObject​(boolean isCreatedByObject)
        Set if SVG image is created from HTML object tag context
        Parameters:
        isCreatedByObject - true if object is created from HTML object tag, false otherwise
      • isCreatedByObject

        public boolean isCreatedByObject()
        Check if SVG image is created from HTML object tag context
        Returns:
        true if object is created from HTML object tag, false otherwise
      • getResult

        public ISvgProcessorResult getResult()
        Returns processor result containing the SVG information.
        Returns:
        {ISvgProcessorResult} processor result.
      • getResourceResolver

        @Deprecated
        public ResourceResolver getResourceResolver()
        Deprecated.
        not used anymore
        Returns resource resolver for the SVG image.
        Returns:
        ResourceResolver instance
      • updateBBox

        public void updateBBox​(float areaWidth,
                               float areaHeight)
        Updated XObject BBox for relative sized SVG image.
        Parameters:
        areaWidth - the area width where SVG image will be drawn
        areaHeight - the area height where SVG image will be drawn
      • getElementWidth

        public UnitValue getElementWidth()
        Gets the SVG element width.
        Returns:
        the SVG element width
      • getElementHeight

        public UnitValue getElementHeight()
        Gets the SVG element height.
        Returns:
        the SVG element height