PdfFileMend

Overview

PdfFileMend is a class in Aspose.Pdf FOSS for Java. Inherits from: Closeable.

Legacy “mend” facade for adding raster images and {@link FormattedText} annotations to existing PDFs without rebuilding the page from scratch.

Properties

NameTypeAccessDescription
documentDocumentReadReturns the bound document, or {@code null} when none is set.

Methods

SignatureDescription
PdfFileMend()Empty {@code PdfFileMend}.
PdfFileMend(inputFile: String)Bound to {@code inputFile}.
PdfFileMend(inputFile: String, outputFile: String)Bound to {@code inputFile} and primed to write the result to {@code outputFile}
when {@link #save()} is called.
PdfFileMend(inputStream: InputStream, outputStream: OutputStream)Bound to streams; the input is parsed eagerly, the output is wired for {@link #close()}.
PdfFileMend(document: Document)Bound to an already-opened document.
save()booleanWrites the bound document to the file supplied via the
{@link #PdfFileMend(String, String)} constructor.
getDocument()DocumentReturns the bound document, or {@code null} when none is set.
setInputFile(inputFile: String)Mirrors C# {@code InputFile} setter: opens {@code inputFile} into a new {@link Document}.
bindPdf(inputFile: String)booleanLoads a fresh {@link Document} from {@code inputFile}.
bindPdf(inputStream: InputStream)booleanLoads a fresh {@link Document} from {@code inputStream}.
bindPdf(document: Document)booleanBinds an already-loaded document.
addImage(imageFile: String, pageNumber: int, llx: double, lly: double, urx: double, ury: double)booleanAdds the image at {@code imageFile} to {@code pageNumber} positioned at
the rectangle {@code [llx,lly] – [urx,ury]}.
addImage(imageStream: InputStream, pageNumber: int, llx: double, lly: double, urx: double, ury: double)booleanAdds the image content read from {@code imageStream} to {@code pageNumber}.
addText(text: FormattedText, pageNumber: int, x: double, y: double)booleanAdds {@code text} to {@code pageNumber} starting at {@code (x, y)} (PDF
user-space coordinates, origin at bottom-left).
addText(text: FormattedText, pageNumber: int, x: float, y: float)booleanBackwards-compatible float overload (matches the legacy C# signature).
save(outputFile: String)booleanSaves the bound document to {@code outputFile}.
save(outputStream: OutputStream)booleanSaves the bound document to {@code outputStream}.
close()Releases the bound document.

See Also