> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/android/editing-page-content/stamp.md).

# Adding a stamp to PDFs in Android

Stamp PDF pages with text, images, or other PDF pages using Apryse SDK. Learn how to embed fonts, copy graphical elements, and add watermarks easily. Explore the benefits of Stamper for efficient PDF

A stamp in a PDF document is analogous to applying a rubber stamp on a paper document.

Apryse SDK benefits include:

* Stamp PDF pages with text, images, or with other PDF pages.
* Embed fonts and images, and copy graphical elements from one page to another.

## Use Stamper to stamp content (text, image, PDF page)

To stamp text, image, and a PDF page to a PDF document.

{% tabs %}
{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFDoc doc = new PDFDoc(filename);
Stamper s = new Stamper(Stamper.e_relative_scale, .05, .05);

// Specifies if the stamp is to be stamped as an annotation.
// note that stamps created with this setting do not work with SetAsBackground, HasStamps, and DeleteStamps, if annotation is true.
//s.setAsAnnotation(true);

s.setAlignment(Stamper.e_horizontal_right, Stamper.e_vertical_bottom);
s.setAlignment(Stamper.e_horizontal_center, Stamper.e_vertical_top);
s.setFont(Font.create(doc, Font.e_courier, true));
ColorPt red = new ColorPt(1, 0, 0, 0);
s.setFontColor(red); //set color to red
s.setTextAlignment(Stamper.e_align_right);
s.setAsBackground(true); //set text stamp as background
PageSet ps = new PageSet(1, 2);
s.stampText(doc, "This is a title!", ps);

Image img = Image.create(doc, imagename);
s.setAsBackground(false); // set image stamp as foreground
PageSet first_page_ps = new PageSet(1);
s.stampImage(doc, img, first_page_ps);

PDFDoc src_doc = new PDFDoc(src_filename);
Page src_page = src_doc.getPage(1);
s.stampPage(doc, src_page, first_page_ps);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val doc = PDFDoc(filename)
val s = Stamper(Stamper.e_relative_scale, .05, .05)

// Specifies if the stamp is to be stamped as an annotation.
// note that stamps created with this setting do not work with SetAsBackground, HasStamps, and DeleteStamps, if annotation is true.
//s.setAsAnnotation(true)

s.setAlignment(Stamper.e_horizontal_right, Stamper.e_vertical_bottom)
s.setAlignment(Stamper.e_horizontal_center, Stamper.e_vertical_top)
s.setFont(Font.create(doc, Font.e_courier, true))
val red = ColorPt(1.0, 0.0, 0.0, 0.0)
s.setFontColor(red) //set color to red
s.setTextAlignment(Stamper.e_align_right)
s.setAsBackground(true) //set text stamp as background
val ps = PageSet(1, 2)
s.stampText(doc, "This is a title!", ps)

val img = Image.create(doc, imagename)
s.setAsBackground(false) // set image stamp as foreground
val first_page_ps = PageSet(1)
s.stampImage(doc, img, first_page_ps)

val src_doc = PDFDoc(src_filename)
val src_page = src.getPage(1)
s.stampPage(doc, src_page, ps)
```

{% endcode %}
{% endtab %}
{% endtabs %}

[Stamp a PDF File](/android/get-started/samples.md#stamper) Full code sample which shows how to stamp PDF pages with text, images, or with other PDF pages and how to add new content (or watermark).

## About Stamper

Stamper can be used for PDF pages with text, images, or with other PDF content in only a few lines of code. Although Stamper is very simple to use compared to ElementBuilder/ElementWriter it is not as powerful or flexible. In case you need full control over PDF creation use ElementBuilder/ElementWriter to add new content to existing PDF pages as shown in the [ElementBuilder sample project ](/android/get-started/samples.md#elementbuilder).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/android/editing-page-content/stamp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
