Comprehensive Guide for Developers: Features, Integration, and API Reference
Stamps PDF pages with text, raster images or another PDF page. More...
#include <pdfsdk/cxx/stamper.h>
Public Member Functions | |
| void | SetSize (PDFStampSizeMode sizeMode, float a, float b) |
| Sets how the stamp is sized. Overrides the value passed to Create. | |
| void | SetPosition (float horizontalDistance, float verticalDistance, bool usePercentage=false) |
| Sets the offset of the stamp from the alignment anchor. Default is no offset (0, 0). | |
| void | SetAlignment (PDFStampHAlign hAlign, PDFStampVAlign vAlign) |
| Sets the anchor that the position offset is measured from. Default is centered (kPDFStampHAlignCenter, kPDFStampVAlignCenter). | |
| void | SetRotation (float degrees) |
| Sets the rotation of the stamp, in degrees, counter-clockwise. Default is 0 (no rotation). | |
| void | SetOpacity (float opacity) |
| Sets the opacity of the stamp. | |
| void | SetAsBackground (bool background) |
| Specifies whether the stamp is placed behind the page content (background) or on top. Default is on top (foreground). | |
| void | SetAsAnnotation (bool annotation) |
| Specifies whether the stamp is added as a Stamp annotation instead of page content. Default is page content. | |
| void | ShowsOnScreen (bool onScreen) |
| Specifies whether the stamp is visible on screen. Default is true. | |
| void | ShowsOnPrint (bool onPrint) |
| Specifies whether the stamp is visible when the document is printed. Default is true. | |
| void | ShowsInLayersPanel (bool inLayersPanel) |
| Specifies whether the stamp's optional-content layer is registered in the document's layer order (/Order) so it appears in a viewer's layers panel. Default is false. | |
| void | SetName (const std::wstring &name) |
| Sets the stamp name. Default is "Stamp". | |
| void | SetFont (const PDFontInfo &fontInfo) |
| Sets the font used for text stamps. | |
| void | SetFontColor (PDColorValue color) |
| Sets the color used for text stamps. | |
| void | SetTextOutline (PDColorValue strokeColor, float strokeWidth) |
| Gives text stamps an outline (stroke), in addition to or instead of the fill. | |
| void | SetTextAlignment (PDFStampTextAlign textAlign) |
| Sets the alignment of multi-line text within a text stamp. Default is kPDFStampTextAlignLeft. | |
| void | StampText (const Document &destDoc, const std::wstring &text, const std::vector< size_t > &destPages={}) |
| Stamps text onto the given pages using the configured font, color and text alignment. | |
| void | StampImage (const Document &destDoc, const Graphics::Bitmap &bitmap, const std::vector< size_t > &destPages={}) |
| Stamps a raster image from an in-memory bitmap onto the given pages. | |
| void | StampImageFromFile (const Document &destDoc, const std::filesystem::path &imagePath, const std::vector< size_t > &destPages={}) |
| Stamps a raster image loaded from a file onto the given pages. | |
| void | StampPage (const Document &destDoc, const Document &srcDoc, size_t srcPageIndex, const std::vector< size_t > &destPages={}) |
| Stamps a single page from a source PDF document (as vector art) onto the given pages. | |
Static Public Member Functions | |
| static Stamper | Create (PDFStampSizeMode sizeMode, float a, float b) |
| Creates a new Stamper with an initial size. | |
| static bool | HasStamps (const Document &doc, const std::vector< size_t > &pages={}) |
| Reports whether any of the given pages contains at least one stamp. | |
| static void | DeleteStamps (const Document &doc, const std::vector< size_t > &pages={}) |
| Deletes all stamps from the given pages. | |
Stamps PDF pages with text, raster images or another PDF page.
A Stamper is a configuration object: set the size, position, alignment, rotation and opacity once, then call one of the Stamp* methods repeatedly to apply the stamp to a set of pages. Stamped content is wrapped in a standard PDF marked-content artifact so it can be located and removed later via HasStamps / DeleteStamps.
For full control over PDF content creation use the Element / Content API instead.
|
inlinestatic |
Creates a new Stamper with an initial size.
| [in] | sizeMode | How the stamp is sized. |
| [in] | a | The horizontal size component. Meaning depends on sizeMode. |
| [in] | b | The vertical size component. Meaning depends on sizeMode. |
|
inlinestatic |
Deletes all stamps from the given pages.
| [in] | doc | The document to delete stamps from. |
| [in] | pages | The zero-based page indices to delete stamps from. Empty means all pages. |
|
inlinestatic |
Reports whether any of the given pages contains at least one stamp.
| [in] | doc | The document to check. |
| [in] | pages | The zero-based page indices to check. Empty means all pages. |
|
inline |
Sets the anchor that the position offset is measured from. Default is centered (kPDFStampHAlignCenter, kPDFStampVAlignCenter).
| [in] | hAlign | Horizontal anchor. |
| [in] | vAlign | Vertical anchor. |
|
inline |
Specifies whether the stamp is added as a Stamp annotation instead of page content. Default is page content.
Annotation stamps are not affected by SetAsBackground and are not found or removed by HasStamps / DeleteStamps.
| [in] | annotation | If true, the stamp is added as a Stamp annotation; otherwise into the page content. |
|
inline |
Specifies whether the stamp is placed behind the page content (background) or on top. Default is on top (foreground).
| [in] | background | If true, the stamp is inserted as a background layer; otherwise on top. |
|
inline |
Sets the font used for text stamps.
| [in] | fontInfo | The font description (family, format, style). |
|
inline |
Sets the color used for text stamps.
| [in] | color | The font color. |
|
inline |
Sets the stamp name. Default is "Stamp".
Used as the annotation title for annotation stamps, and as the optional content layer name for content stamps whose screen/print visibility is restricted.
| [in] | name | The name. |
|
inline |
Sets the opacity of the stamp.
| [in] | opacity | The opacity in the range [0, 1], where 1 is fully opaque. Default is 1. |
|
inline |
Sets the offset of the stamp from the alignment anchor. Default is no offset (0, 0).
| [in] | horizontalDistance | Horizontal offset from the left/right/center anchor. |
| [in] | verticalDistance | Vertical offset from the top/bottom/center anchor. |
| [in] | usePercentage | If true, the distances are fractions of the crop box width/height; if false, they are measured in points. |
|
inline |
Sets the rotation of the stamp, in degrees, counter-clockwise. Default is 0 (no rotation).
| [in] | degrees | The rotation in degrees. |
|
inline |
Sets how the stamp is sized. Overrides the value passed to Create.
| [in] | sizeMode | How the stamp is sized. |
| [in] | a | The horizontal size component. Meaning depends on sizeMode. |
| [in] | b | The vertical size component. Meaning depends on sizeMode. |
|
inline |
Sets the alignment of multi-line text within a text stamp. Default is kPDFStampTextAlignLeft.
| [in] | textAlign | The text alignment. |
|
inline |
Gives text stamps an outline (stroke), in addition to or instead of the fill.
| [in] | strokeColor | The outline (stroke) color, or kPDColorNone to disable the outline (fill only). |
| [in] | strokeWidth | The outline (stroke) width, in the stamp's coordinate space. |
|
inline |
Specifies whether the stamp's optional-content layer is registered in the document's layer order (/Order) so it appears in a viewer's layers panel. Default is false.
| [in] | inLayersPanel | If true, the created layer is added to the configuration's /Order. |
|
inline |
Specifies whether the stamp is visible when the document is printed. Default is true.
| [in] | onPrint | If true, the stamp is printed. |
|
inline |
Specifies whether the stamp is visible on screen. Default is true.
| [in] | onScreen | If true, the stamp is shown on screen. |
|
inline |
Stamps a raster image from an in-memory bitmap onto the given pages.
| [in] | destDoc | The document being stamped. |
| [in] | bitmap | The image bitmap to stamp. |
| [in] | destPages | The zero-based page indices to stamp. Empty means all pages. |
|
inline |
Stamps a raster image loaded from a file onto the given pages.
| [in] | destDoc | The document being stamped. |
| [in] | imagePath | The path to the image file (.png .jpg .bmp .gif etc.). |
| [in] | destPages | The zero-based page indices to stamp. Empty means all pages. |
|
inline |
Stamps a single page from a source PDF document (as vector art) onto the given pages.
| [in] | destDoc | The document being stamped. |
| [in] | srcDoc | The source PDF document that contains the page to stamp. |
| [in] | srcPageIndex | The zero-based index of the source page in srcDoc. |
| [in] | destPages | The zero-based page indices to stamp. Empty means all pages. |
|
inline |
Stamps text onto the given pages using the configured font, color and text alignment.
| [in] | destDoc | The document being stamped. |
| [in] | text | The text to stamp. |
| [in] | destPages | The zero-based page indices to stamp. Empty means all pages. |