ImageWriterPdf Class

class ImageWriterPdf(file: File) : ImageWriter, ImageFileWriter

Writes scanned pages into a PDF document, one page per image.

Unlike the single-image writers, every page goes into the one file given here, in the order written. Call close to finish the document — a PDF left unclosed is not readable.

Parameters

  • file — the file to write to. It is created if it does not exist and overwritten if it does.

Constructors

ImageWriterPdf

constructor(file: File)

Types

ImageCompression

class ImageCompression(compressionRate: Float) : ScanningSdkLibrary.Instance

How page images are compressed inside the PDF, trading file size against fidelity.

Functions

close

@Synchronized open override fun close()

Finish rendering and release the writer’s native memory.

setFontFiles

external fun setFontFiles(fontFiles: Iterable<File>)

Sets the fonts used for the footer.

setImageCompression

external fun setImageCompression(imageCompression: ImageWriterPdf.ImageCompression)

Sets how page images are compressed inside the document.

setTextFontFiles

external fun setTextFontFiles(fontFiles: Iterable<File>)

Sets the fonts used for the hidden text layer.

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.

writeFile

open external override fun writeFile(image: File, orientation: ScanOrientation, text: ScanText, textOrientation: ScanOrientation)

Copies an already-encoded image straight into the PDF, without decoding it.

Top