Interface SVGRasterizer


  • @Role
    public interface SVGRasterizer
    Utilities for working with SVG images.
    Since:
    8.0M1
    Version:
    $Id: 09d61ebcaa15cc3370c85fa4cfe2e4fd9110fbf4 $
    • Method Detail

      • rasterizeToTemporaryFile

        File rasterizeToTemporaryFile​(String content,
                                      int width,
                                      int height)
                               throws IOException
        Rasterize an image as PNG into a temporary file.
        Parameters:
        content - the SVG image
        width - the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        height - the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        Returns:
        the file where the PNG is stored
        Throws:
        IOException - if temporary files can't be accessed
      • rasterizeToTemporaryResource

        TemporaryResourceReference rasterizeToTemporaryResource​(String content,
                                                                int width,
                                                                int height)
                                                         throws IOException
        Rasterize an image as PNG into a temporary resource belonging to the current document, accessible through the "tmp" resource URL handler.
        Parameters:
        content - the SVG image
        width - the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        height - the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        Returns:
        the temporary resource where the PNG is stored
        Throws:
        IOException - if temporary files can't be accessed
      • rasterizeToTemporaryResource

        TemporaryResourceReference rasterizeToTemporaryResource​(String content,
                                                                int width,
                                                                int height,
                                                                DocumentReference targetContext)
                                                         throws IOException
        Rasterize an image as PNG into a temporary resource belonging to the specified document, accessible through the "tmp" resource URL handler.
        Parameters:
        content - the SVG image
        width - the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        height - the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        targetContext - the document which will "own" the new temporary resource
        Returns:
        the temporary resource where the PNG is stored
        Throws:
        IOException - if temporary files can't be accessed
      • rasterizeToResponse

        void rasterizeToResponse​(String content,
                                 int width,
                                 int height)
                          throws IOException
        Rasterize an image as PNG into the current response.
        Parameters:
        content - the SVG image
        width - the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        height - the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is used
        Throws:
        IOException - if writing the response fails