ImageWriter Class
abstract class ImageWriter : ScanningSdkLibrary.Instance, Closeable
Writes scanned pages out to a file, one page at a time.
Pick the subclass for the format you want — ImageWriterPdf, ImageWriterPng, ImageWriterTiff — then call write once per page and close to finish the file.
ImageWriterPdf(file).use { writer ->
pages.forEach { writer.write(it) }
}
Unlike the scan types, closing a writer is not optional: close finishes rendering the output file and releases the writer’s native memory. Prefer Kotlin’s use { } or try-with-resources.
Inheritors
Constructors
ImageWriter
constructor()
Types
Dimension
sealed interface Dimension
A measurement of the output page, either fixed or growing to fit its content.
Paper
class Paper(val width: ImageWriter.Dimension, val height: ImageWriter.Dimension, val margins: ImageWriter.Dimension.Fixed)
Page dimensions given explicitly.
Functions
close
@Synchronized open override fun close()
Finish rendering and release the writer’s native memory.
setupFooter
open external fun setupFooter(text: String, url: String, height: ImageWriter.Dimension)
Adds a footer line to every page of the output.
setupPaper
open external fun setupPaper(paper: ImageWriter.Paper, orientation: ImageWriter.Paper.Orientation)
Sets the output page size from explicit measurements.
setupPaperSize
open external fun setupPaperSize(paperSize: ImageWriter.Paper.Size, orientation: ImageWriter.Paper.Orientation)
Sets the output page size from a standard paper size.
write
open external fun write(image: ScanPicture): File
Appends one page to the output file.