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
| Name | Type | Access | Description |
|---|---|---|---|
document | Document | Read | Returns the bound document, or {@code null} when none is set. |
Methods
| Signature | Description |
|---|---|
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() → boolean | Writes the bound document to the file supplied via the |
| {@link #PdfFileMend(String, String)} constructor. | |
getDocument() → Document | Returns 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) → boolean | Loads a fresh {@link Document} from {@code inputFile}. |
bindPdf(inputStream: InputStream) → boolean | Loads a fresh {@link Document} from {@code inputStream}. |
bindPdf(document: Document) → boolean | Binds an already-loaded document. |
addImage(imageFile: String, pageNumber: int, llx: double, lly: double, urx: double, ury: double) → boolean | Adds 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) → boolean | Adds the image content read from {@code imageStream} to {@code pageNumber}. |
addText(text: FormattedText, pageNumber: int, x: double, y: double) → boolean | Adds {@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) → boolean | Backwards-compatible float overload (matches the legacy C# signature). |
save(outputFile: String) → boolean | Saves the bound document to {@code outputFile}. |
save(outputStream: OutputStream) → boolean | Saves the bound document to {@code outputStream}. |
close() | Releases the bound document. |