Show / Hide Table of Contents

Class Stamper

Stamper is a utility class that can be used to stamp PDF pages with text, images, or vector art (including another PDF page) 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.

Inheritance
System.Object
Stamper
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: pdftron.PDF
Assembly: PDFNetiOS.dll
Syntax
public class Stamper : IDisposable

Constructors

Stamper(Stamper.SizeType, Double, Double)

Stamper constructor.

Declaration
public Stamper(Stamper.SizeType size_type, double a, double b)
Parameters
Type Name Description
Stamper.SizeType size_type

Specifies how the stamp will be sized. See the link Enum Stamper.SizeType on the left for more details.

System.Double a

Generally the horizontal component of the size. See size_type for more details.

System.Double b

Generally the vertical component of the size. See size_type for more details.

Methods

DeleteStamps(PDFDoc, PageSet)

Deletes PDFTron stamps from document at given page numbers.

Declaration
public static void DeleteStamps(PDFDoc doc, PageSet page_set)
Parameters
Type Name Description
PDFDoc doc

The document to delete stamps from

PageSet page_set

The set of pages to delete stamps from

Destroy()

Declaration
public void Destroy()

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Finalize()

Declaration
protected void Finalize()

HasStamps(PDFDoc, PageSet)

Returns true if the given set of pages has at least one stamp.

Declaration
public static bool HasStamps(PDFDoc doc, PageSet page_set)
Parameters
Type Name Description
PDFDoc doc

The document that's being checked

PageSet page_set

The set of page that's being checked

Returns
Type Description
System.Boolean

true, if successful

SetAlignment(Stamper.HorizontalAlignment, Stamper.VerticalAlignment)

Sets the alignment for the x and y variables.

Declaration
public void SetAlignment(Stamper.HorizontalAlignment horizontal_alignment, Stamper.VerticalAlignment vertical_alignment)
Parameters
Type Name Description
Stamper.HorizontalAlignment horizontal_alignment

the horizontal alignment

Stamper.VerticalAlignment vertical_alignment

the vertical alignment

See Also
SetPosition(Double, Double, Boolean)

SetAsAnnotation(Boolean)

Specifies if the stamp is to be stamped as annotation or not.

Declaration
public void SetAsAnnotation(bool annotation)
Parameters
Type Name Description
System.Boolean annotation

A flag specifying if the stamp should be added as an annotation to the destination page

Remarks

SetAsBackground, HasStamps and DeleteStamps methods will not work on stamps created with this as true.

SetAsBackground(Boolean)

Specifies if the stamp is to be stamped in the background or the foreground.

Declaration
public void SetAsBackground(bool background)
Parameters
Type Name Description
System.Boolean background

A flag specifying if the stamp should be added as a background layer to the destination page

SetFont(Font)

Defines the font of the stamp. (This only applies to text-based stamps)

Declaration
public void SetFont(Font font)
Parameters
Type Name Description
Font font

The font of the text stamp

SetFontColor(ColorPt)

Sets the font color (This only effects text-based stamps).

Declaration
public void SetFontColor(ColorPt color)
Parameters
Type Name Description
ColorPt color

the new font color

SetOpacity(Double)

Sets the opacity value for the stamp.

Declaration
public void SetOpacity(double opacity)
Parameters
Type Name Description
System.Double opacity

The opacity value of the stamp

SetPosition(Double, Double, Boolean)

Sets the horizontal and vertical position of the stamp.

Declaration
public void SetPosition(double horizontal_distance, double vertical_distance, bool percentage = false)
Parameters
Type Name Description
System.Double horizontal_distance

Horizontal distance from left, right or center of crop box

System.Double vertical_distance

the vertical_distance

System.Boolean percentage

If true, horizontal_distance is a percentage of the crop box width (e.g.: 0.5 is 50% of the width of the crop box) and vertical_distance is a percentage of the crop box height. If false, horizontal_distance and vertical_distance is measured in points.

See Also
SetAlignment(Stamper.HorizontalAlignment, Stamper.VerticalAlignment)

SetRotation(Double)

Rotates the stamp by the given number of degrees.

Declaration
public void SetRotation(double rotation)
Parameters
Type Name Description
System.Double rotation

Rotation in degrees

SetSize(Stamper.SizeType, Double, Double)

Sets the size of the stamp.

Declaration
public void SetSize(Stamper.SizeType size_type, double a, double b)
Parameters
Type Name Description
Stamper.SizeType size_type

Specifies how the stamp will be sized

System.Double a

the a

System.Double b

the b

SetTextAlignment(Stamper.TextAlignment)

Sets the text alignment (note: this only applies to text watermarks).

Declaration
public void SetTextAlignment(Stamper.TextAlignment text_alignment)
Parameters
Type Name Description
Stamper.TextAlignment text_alignment

Enumerator for text alignment (e_left, e_center, e_right)

ShowsOnPrint(Boolean)

Shows on print.

Declaration
public void ShowsOnPrint(bool on_print)
Parameters
Type Name Description
System.Boolean on_print

Specifies if the watermark will be displayed when printed

ShowsOnScreen(Boolean)

Shows on screen.

Declaration
public void ShowsOnScreen(bool on_screen)
Parameters
Type Name Description
System.Boolean on_screen

Specifies if the watermark will be displayed on screen

StampImage(PDFDoc, Image, PageSet)

Stamps an image to the given destination document at the set of page numbers.

Declaration
public void StampImage(PDFDoc dest_doc, Image src_img, PageSet dest_pages)
Parameters
Type Name Description
PDFDoc dest_doc

The document being stamped

Image src_img

The image that is being stamped to the document

PageSet dest_pages

The set of pages in the document being stamped

StampPage(PDFDoc, Page, PageSet)

Stamps a PDF page to the given destination document at the set of page numbers.

Declaration
public void StampPage(PDFDoc dest_doc, Page src_page, PageSet dest_pages)
Parameters
Type Name Description
PDFDoc dest_doc

The document being stamped

Page src_page

The page that is being stamped to the document

PageSet dest_pages

The set of pages in the document being stamped

StampText(PDFDoc, String, PageSet)

Stamps text to the given destination document at the set of page numbers.

Declaration
public void StampText(PDFDoc dest_doc, string src_txt, PageSet dest_pages)
Parameters
Type Name Description
PDFDoc dest_doc

The document being stamped

System.String src_txt

The image that is being stamped to the document

PageSet dest_pages

The set of pages in the document being stamped

Implements

System.IDisposable
In This Article
Back to top Generated by DocFX