Adding dynamic stamps watermarks in WebViewer

273 views
Skip to first unread message

Support

unread,
Sep 4, 2013, 1:28:51 PM9/4/13
to pdfnet-w...@googlegroups.com
Q:
 
We have implemented the watermark scenario using  the pdftron.PDF.Stamper class from PDFNet SDK.

PDFNet.Initialize();

using (PDFDoc doc = new PDFDoc("my.pdf")) {
 string _strWaterMarkText = "sam...@gmail.com "; - > watermark text
 using (Stamper s = new Stamper(Stamper.SizeType.e_relative_scale, 0.05, 0.05) {
   s.SetPosition(0, 0);
  s.SetOpacity(0.2F);
   s.SetRotation(315);
  s.SetFont(Font.Create(doc, Font.StandardType1Font.e_courier, true));
  s.SetFontColor(new ColorPt(0, 0, 1, 0)); //set color                   
  s.SetSize(pdftron.PDF.Stamper.SizeType.e_font_size, 40, -1);
  s.SetTextAlignment(pdftron.PDF.Stamper.TextAlignment.e_align_center);
  s.StampText(doc, _strWaterMarkText, new pdftron.PDF.PageSet(1, 20, pdftron.PDF.PageSet.Filter.e_all)); -> apply watermark

  doc.Save(@"stamped.pdf", SDFDoc.SaveOptions.e_linearized);

-> apply watermark then save it as PDF

}

This works great but we would also like to be able to apply non-editable stamps / watermarks dynamically (without modifying PDF or XPS/XOD.

Questions:

1. can we add water mark text  directly to a XOD file during run time?
2. can we add water mark Image  directly to a XOD file during run time?
-------
A:
 
Yes, this is possible by adding custom 'divs' over top of the pages in the viewer with any custom content you like (e.g. watermark text or image).  See this post for more information: https://groups.google.com/forum/#!topic/pdfnet-webviewer/Kth8hiwNs6Q.  Make sure to change the z-index of the content to be larger than 30.
 
 
 
Reply all
Reply to author
Forward
0 new messages