---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/PdfFileStamp
---

# PdfFileStamp

## Overview

`PdfFileStamp` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `System.IDisposable`.

Facade for adding stamps, page numbers, headers, footers, and watermarks.

This class provides 44 methods for working with PdfFileStamp objects in .NET programs.
Available methods include: `AddFooter`, `AddGrayscaleImageStamp`, `AddHeader`, `AddImageStamp`, `AddPageNumber`, `AddPageNumbers`, `AddStamp`, `AddTextStamp`, `AddWatermark`, `BindPdf`, `Close`, `Dispose`, and 2 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `ConvertTo`, `Document`, `InputFile`, `InputStream`, `KeepSecurity`, `NumberingStyle`, and 16 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Document` | `Document` | Read | The bound document. |
| `InputFile` | `string?` | Read/Write | Input file path. |
| `OutputFile` | `string?` | Read/Write | Output file path. |
| `PageWidth` | `float` | Read | Width of the first page in the bound document. |
| `PageHeight` | `float` | Read | Height of the first page in the bound document. |
| `InputStream` | `Stream?` | Read/Write | Input stream — setting binds the PDF eagerly so page-dimension queries reflect the new input. |
| `OutputStream` | `Stream?` | Read/Write | Output stream — Save() writes here when no explicit destination is passed. |
| `KeepSecurity` | `bool` | Read/Write | If true, the source document's security (encryption, permissions) should be preserved on Save. |
| `NumberingStyle` | `NumberingStyle` | Read/Write | Numbering style for AddPageNumber. |
| `OptimizeSize` | `bool` | Read/Write | Hint: optimize the saved output for size. |
| `PageNumberRotation` | `float` | Read/Write | Rotation (degrees) applied to AddPageNumber stamps. |
| `StampId` | `int` | Read/Write | Stamp identifier embedded as a content-stream comment by AddStamp. |
| `StartingNumber` | `int` | Read/Write | Starting number used by AddPageNumber. |
| `ConvertTo` | `PdfFormat` | Read/Write | PDF/A or PDF version target for the saved output. |
| `PosUpperLeft` | `int` | Read | Gets the pos upper left. |
| `PosUpperMiddle` | `int` | Read | Gets the pos upper middle. |
| `PosUpperRight` | `int` | Read | Gets the pos upper right. |
| `PosSidesLeft` | `int` | Read | Gets the pos sides left. |
| `PosSidesRight` | `int` | Read | Gets the pos sides right. |
| `PosBottomLeft` | `int` | Read | Gets the pos bottom left. |
| `PosBottomMiddle` | `int` | Read | Gets the pos bottom middle. |
| `PosBottomRight` | `int` | Read | Gets the pos bottom right. |

## Methods

| Signature | Description |
|-----------|-------------|
| `PdfFileStamp()` | Default constructor for stateless mode. |
| `PdfFileStamp(document: Document)` | Bind an already-loaded Document. |
| `PdfFileStamp(document: Document, outputStream: Stream)` | Bind a Document and pre-configure an output stream for the parameterless Save. |
| `PdfFileStamp(document: Document, outputFile: string)` | Bind a Document and pre-configure an output file path for the parameterless Save. |
| `PdfFileStamp(inputStream: Stream, outputStream: Stream)` | Open from an input stream, writing to an output stream on Save. |
| `PdfFileStamp(inputStream: Stream, outputStream: Stream, keepSecurity: bool)` | Open from an input stream, writing to an output stream on Save. |
| `PdfFileStamp(inputFile: string, outputFile: string)` | Open from an input file, writing to an output file on Save. |
| `PdfFileStamp(inputFile: string, outputFile: string, keepSecurity: bool)` | Open from an input file, writing to an output file on Save. |
| `PdfFileStamp(inputData: byte[], outputPath: string)` | Create a PdfFileStamp for given input bytes, saving to the given output file on Close(). |
| `BindPdf(path: string)` | Bind a PDF document from a file path for stateful processing. |
| `BindPdf(doc: Document)` | Bind a PDF document for stateful processing. |
| `Save(destFile: string)` | Save the modified document to the specified path. |
| `Save(destStream: Stream)` | Save the modified document to a stream. |
| `Save()` | Save the modified document to a byte array. |
| `AddStamp(stamp: Stamp)` | Add a facade stamp to the bound document. |
| `Close()` | Close the document and save to the output path. |
| `Dispose()` | IDisposable implementation; delegates to Close. |
| `AddHeader(formattedText: FormattedText, topMargin: float)` | Calls AddHeader on this PdfFileStamp instance. |
| `AddHeader(formattedText: FormattedText, topMargin: float, leftMargin: float, rightMargin: float)` |  |
| `AddHeader(imageStream: Stream, topMargin: float)` |  |
| `AddHeader(inputStream: Stream, topMargin: float, leftMargin: float, rightMargin: float)` |  |
| `AddHeader(imageFile: string, topMargin: float)` |  |
| `AddHeader(imageFile: string, topMargin: float, leftMargin: float, rightMargin: float)` |  |
| `AddFooter(formattedText: FormattedText, bottomMargin: float)` | Calls AddFooter on this PdfFileStamp instance. |
| `AddFooter(formattedText: FormattedText, bottomMargin: float, leftMargin: float, rightMargin: float)` |  |
| `AddFooter(imageStream: Stream, bottomMargin: float)` |  |
| `AddFooter(imageStream: Stream, bottomMargin: float, leftMargin: float, rightMargin: float)` |  |
| `AddFooter(imageFile: string, bottomMargin: float)` |  |
| `AddFooter(imageFile: string, bottomMargin: float, leftMargin: float, rightMargin: float)` |  |
| `AddPageNumber(formattedText: FormattedText)` | Calls AddPageNumber on this PdfFileStamp instance. |
| `AddPageNumber(formattedText: FormattedText, position: int)` |  |
| `AddPageNumber(formattedText: FormattedText, position: int, leftMargin: float, rightMargin: float, topMargin: float, bottomMargin: float)` |  |
| `AddPageNumber(formattedText: FormattedText, x: float, y: float)` |  |
| `AddPageNumber(formatString: string)` |  |
| `AddPageNumber(formatString: string, position: int)` |  |
| `AddPageNumber(formatString: string, position: int, leftMargin: float, rightMargin: float, topMargin: float, bottomMargin: float)` |  |
| `AddPageNumber(formatString: string, x: float, y: float)` |  |
| `AddTextStamp(input: byte[], text: string, hAlign: HorizontalAlignment, vAlign: VerticalAlignment, fontSize: double, fontName: string)` | Add a text stamp to all pages. |
| `AddPageNumbers(input: byte[], format: string, hAlign: HorizontalAlignment, vAlign: VerticalAlignment, fontSize: double)` | Add page numbers to all pages. |
| `AddHeader(input: byte[], text: string, fontSize: double, margin: double)` | Add a header text to all pages. |
| `AddFooter(input: byte[], text: string, fontSize: double, margin: double)` | Add a footer text to all pages. |
| `AddWatermark(input: byte[], text: string, fontSize: double, rotation: double, opacity: double)` | Add a watermark text to all pages. |
| `AddImageStamp(input: byte[], rgbPixels: byte[], width: int, height: int, displayWidth: double, displayHeight: double, x: double, y: double)` | Add an RGB image stamp to all pages. |
| `AddGrayscaleImageStamp(input: byte[], grayPixels: byte[], width: int, height: int, displayWidth: double, displayHeight: double, x: double, y: double)` | Add a grayscale image stamp to all pages. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)