Class Renderer

java.lang.Object
io.keikai.axyra.sheets.io.Renderer

public final class Renderer extends Object
Render workbooks to fixed-layout formats — PDF documents and sheet / range images (PNG, SVG).

PDF export honors each sheet's page setup; PdfOptions adds a page range, a sheet subset, a fit-to-page override and encryption. Image export renders one page of a sheet's print layout (page 1, or the page chosen with ImageOptions.Builder.page(int) — enumerate with pageCount(io.keikai.axyra.sheets.Workbook, int)); ImageOptions also controls the pixel scale and gridlines, and the range overloads scope the output to an A1 rectangle.

  • Method Details

    • toPdf

      public static void toPdf(Workbook workbook, Path file)
      Render the whole workbook to a PDF file.
    • toPdf

      public static void toPdf(Workbook workbook, Path file, PdfOptions options)
      Render the workbook to a PDF file honoring options.
    • toPdf

      public static byte[] toPdf(Workbook workbook, PdfOptions options)
      Render the workbook to PDF bytes honoring options (null = defaults).
    • pageCount

      public static int pageCount(Workbook workbook, int sheetIndex)
      Number of printed pages sheetIndex paginates to — the valid range for ImageOptions.Builder.page(int) and the PDF export's page numbering.
    • toPng

      public static byte[] toPng(Workbook workbook, int sheetIndex, ImageOptions options)
      Render one sheet to PNG bytes — page 1 of its print layout, or the page selected in options.
    • toPng

      public static byte[] toPng(Workbook workbook, int sheetIndex, String rangeA1, ImageOptions options)
      Render an A1 range (e.g. "B2:F20") of a sheet to PNG bytes.
    • toSvg

      public static byte[] toSvg(Workbook workbook, int sheetIndex, ImageOptions options)
      Render one sheet (first page of its print layout) to SVG bytes (UTF-8).
    • toSvg

      public static byte[] toSvg(Workbook workbook, int sheetIndex, String rangeA1, ImageOptions options)
      Render an A1 range of a sheet to SVG bytes (UTF-8).
    • toImage

      public static byte[] toImage(Workbook workbook, int sheetIndex, String format, ImageOptions options)
      Render one sheet to the given raster format — "png", "jpeg", "gif", "bmp" or "tiff". JPEG is opaque, so the page composites over white paper.
    • toImage

      public static byte[] toImage(Workbook workbook, int sheetIndex, String rangeA1, String format, ImageOptions options)
      Render an A1 range of a sheet to the given raster format.
    • toJpeg

      public static byte[] toJpeg(Workbook workbook, int sheetIndex, ImageOptions options)
      Render one sheet to JPEG bytes (composited over white).
    • toGif

      public static byte[] toGif(Workbook workbook, int sheetIndex, ImageOptions options)
      Render one sheet to GIF bytes.
    • toBmp

      public static byte[] toBmp(Workbook workbook, int sheetIndex, ImageOptions options)
      Render one sheet to BMP bytes.
    • toTiff

      public static byte[] toTiff(Workbook workbook, int sheetIndex, ImageOptions options)
      Render one sheet to TIFF bytes.