Class ImageOptions.Builder

java.lang.Object
io.keikai.axyra.sheets.io.ImageOptions.Builder
Enclosing class:
ImageOptions

public static final class ImageOptions.Builder extends Object
Fluent builder for ImageOptions; see ImageOptions.builder().
  • Method Details

    • scale

      public ImageOptions.Builder scale(double scale)
      Sets the zoom over the 96-DPI base: 1.0 = 96 DPI (1 pt = 4/3 px), 2.0 = 192 DPI. Applies to raster output (PNG, JPEG, GIF, BMP, TIFF) only; SVG output is sized in points and ignores it. Ignored when targetWidthPx(int) is set.
      Parameters:
      scale - the zoom; 0.01 or below, and NaN, are treated as 0.01. A scale that makes the image too large makes the render call throw AxyraException
      Returns:
      this builder
    • targetWidthPx

      public ImageOptions.Builder targetWidthPx(int widthPx)
      Sets the exact output width in pixels. The height keeps the page's aspect ratio, and this overrides scale(double). Raster output only; SVG ignores it.
      Parameters:
      widthPx - the width in pixels; 0 gives a 1-pixel-wide image, and a negative width makes the render call throw AxyraException
      Returns:
      this builder
    • gridLines

      public ImageOptions.Builder gridLines(boolean show)
      Forces gridlines on or off. Without this call the sheet's own print-gridlines setting applies.
      Parameters:
      show - true to draw gridlines
      Returns:
      this builder
    • page

      public ImageOptions.Builder page(int page)
      Renders the given printed page, 1-based over the sheet's print pagination (the numbering the PDF export uses). Default: page 1. An empty sheet renders page 1 as a blank page at its paper size. Use Renderer.pageCount(io.keikai.axyra.sheets.Workbook, int) for the number of pages.
      Parameters:
      page - the 1-based page; page 0, a negative page, or a page past Renderer.pageCount(io.keikai.axyra.sheets.Workbook, int) makes the render call throw AxyraException
      Returns:
      this builder
    • fontDirs

      public ImageOptions.Builder fontDirs(List<String> dirs)
      Sets the extra directories scanned for fonts, on top of the host's own font paths, replacing any set before.

      A workbook whose fonts are not installed on the rendering machine is drawn with substitute fonts. Every character width then changes, so text wraps and clips differently from the original. Point the renderer at the directory that holds those font files to make the output match. Directories that do not exist are skipped; they do not fail the render.

      Parameters:
      dirs - directory paths; null clears the list
      Returns:
      this builder
    • addFontDir

      public ImageOptions.Builder addFontDir(String dir)
      Adds one directory to fontDirs(java.util.List).
      Parameters:
      dir - the directory path; null or empty is ignored
      Returns:
      this builder
    • build

      public ImageOptions build()
      Builds immutable options; later builder calls do not change them.
      Returns:
      the options