---
title: "page_add_stamp"
url: "https://reference.aspose.com/pdf/rust-cpp/organize/page_add_stamp/"
product: "Aspose.PDF for Rust via C++"
description: "Adds stamp on page."
---


_Adds stamp on page._

```rust
pub fn page_add_stamp(
    &self,
    num: i32,
    alternative_text: &str,
    image_data: &[u8],
    is_background: bool,
    x_indent: i32,
    y_indent: i32,
    height: i32,
    width: i32,
    rotation: Rotation,
    opacity: f64,
) -> Result<(), PdfError>
```

**Arguments**
  * **num** - the page number (1-based)
  * **alternative_text** - the alternative stamp text
  * **image_data** - the raw bytes of the image
  * **is_background** - the stamp is background
  * **x_indent** - the x indent of the stamp
  * **y_indent** - the y indent of the stamp
  * **height** - the height of the stamp
  * **width** - the width of the stamp
  * **rotation** - rotation angle as enum `Rotation`: `None`, `On90`, `On180`, `On270`, or `On360`
  * **opacity** - the opacity (decimal)

**Returns**
  * **Ok(())** - if the operation succeeds
  * **Err(PdfError)** - if the operation fails

**Example**

```rust
use asposepdf::{Document, Rotation};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Open a PDF-document with filename
    let pdf = Document::open("sample.pdf")?;

    // Load stamp image data
    let image_data = std::fs::read("stamp.png")?;

    // Add a stamp on page #1
    pdf.page_add_stamp(
        1,
        "PageStamp",
        &image_data,
        true,
        100,
        100,
        50,
        50,
        Rotation::On90,
        0.5,
    )?;

    // Save the previously opened PDF-document with new filename
    pdf.save_as("sample_page_add_stamp.pdf")?;

    Ok(())
}

```