Some test text!
A stamp in a PDF document is analogous to applying a rubber stamp on a paper document.
PDFTron SDK benefits include:
To stamp text, image, and a PDF page to a PDF document.
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename]; PTStamper *s = [[PTStamper alloc] initWithSize_type: e_ptrelative_scale a: 0.05 b: 0.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: YES]; [s SetAlignment: e_pthorizontal_right vertical_alignment: e_ptvertical_bottom]; [s SetAlignment: e_pthorizontal_center vertical_alignment: e_ptvertical_top]; [s SetFont: [PTFont Create: [doc GetSDFDoc] type: e_ptcourier embed: YES]]; PTColorPt *red = [[PTColorPt alloc] initWithX: 1 y: 0 z: 0 w: 0]; [s SetFontColor: red]; //set color to red [s SetTextAlignment: e_ptalign_right]; [s SetAsBackground: YES]; //set text stamp as background PTPageSet *ps = [[PTPageSet alloc] initWithRange_start: 1 range_end: 2 filter: e_ptall]; [s StampText: doc src_txt: @"This is a title!" dest_pages: ps]; PTImage *img = [PTImage Create: [doc GetSDFDoc] filename: imagename]; [s SetAsBackground: NO]; // set image stamp as foreground PTPageSet *first_page_ps = [[PTPageSet alloc] initWithOne_page: 1]; [s StampImage: doc src_img: img dest_pages: first_page_ps]; PTPDFDoc *src_doc = [[PTPDFDoc alloc ] initWithFilepath: src_filename]; PTPage *src_page = [src_doc GetPage: 1]; [s StampPage: doc src_page: src_page dest_pages: ps];
Stamp a PDF File
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).
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.
Get the answers you need: Support
Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.
Select a platform to get started with your free trial.
Unlimited usage. No email address required.
Join our live demo to learn about use cases & capabilities for WebViewerLearn more