BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

AddWatermark Method

Add watermark

Sub AddWatermark(hpos As prcWmarkHPosition,
                 vpos As prcWmarkVPosition,
                 zpos As prcWmarkZOrder,
                 alignment As prcWmarkAlignment,
                 hoffset As Double,
                 voffset As Double,
                 firstPageOnly As Boolean,
                 font As String,
                 fontsize As Double,
                 embedding As prcFontEmbedding,
                 angle As Double,
                 color As OLE_COLOR,
                 opacity As Double,
                 outlineOnly As Boolean,
                 text As String)

void AddWatermark(prcWmarkHPosition hpos,
                  prcWmarkVPosition vpos,
                  prcWmarkZOrder zpos,
                  prcWmarkAlignment alignment,
                  double hoffset,
                  double voffset,
                  bool firstPageOnly,
                  string font,
                  double fontsize,
                  prcFontEmbedding embedding,
                  double angle,
                  System.UInt32 color,
                  double opacity,
                  bool outlineOnly,
                  string text)

void AddWatermark(prcWmarkHPosition hpos,
                  prcWmarkVPosition vpos,
                  prcWmarkZOrder zpos,
                  prcWmarkAlignment alignment,
                  double hoffset,
                  double voffset,
                  boolean firstPageOnly,
                  String font,
                  double fontsize,
                  prcFontEmbedding embedding,
                  double angle,
                  int color,
                  double opacity,
                  boolean outlineOnly,
                  String text) throws PDFProcessorException

Parameters

Return Values

N/A.

Remarks

Note 1: Coordinate system information:

  1. The location of the origin (0, 0) is at top-left corner.

Note 2: OLE_COLOR conversion from various programming languages:

C++:

static_cast<OLE_COLOR>(RGB(0, 0, 255))

VB6:

RGB(0, 0, 255)

VB.NET:

Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))

C#:

(uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))

Others:

32 bit integer value in following format: 0x00bbggrr (in BGR format, not in RGB)

For more information about color translation, refer to MSDN Knowledge Base article Q131101.

Example Usage in VBScript

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf")

oProcessorHandle.AddWatermark PRC_WMARK_HPOS_CENTER, _ 
                              PRC_WMARK_VPOS_TOP, _ 
                              PRC_WMARK_ZORDER_TOP, _
                              PRC_WMARK_ALIGN_CENTER, _
                              0, _
                              0, _
                              False, _
                              "Arial", _
                              40, _
                              0, _
                              35, _
                              RGB(255, 0, 255), _
                              50, _
                              True, _
                              "Watermark"
                                                          
oProcessorHandle.Close

Example Usage in VB.NET

Dim oProcessor As PDFProcessor = New PDFProcessor
Dim oProcessorHandle As PDFProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf")

oProcessorHandle.AddWatermark(prcWmarkHPosition.PRC_WMARK_HPOS_CENTER, _
                              prcWmarkVPosition.PRC_WMARK_VPOS_TOP, _
                              prcWmarkZOrder.PRC_WMARK_ZORDER_TOP, _
                              prcWmarkAlignment.PRC_WMARK_ALIGN_CENTER, _
                              0, _
                              0, _
                              False, _
                              "Arial", _
                              40.0, _
                              prcFontEmbedding.PRC_FONT_EMBED_FULLSET, _
                              35.0, _
                              Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(255, 0, 255))), _
                              50.0, _
                              True, _
                              "Watermark")
                                                                 
oProcessorHandle.Close()

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();
PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\output.pdf", null);

oProcessorHandle.AddWatermark(prcWmarkHPosition.PRC_WMARK_HPOS_CENTER, 
                              prcWmarkVPosition.PRC_WMARK_VPOS_TOP, 
                              prcWmarkZOrder.PRC_WMARK_ZORDER_TOP, 
                              prcWmarkAlignment.PRC_WMARK_ALIGN_CENTER, 
                              0, 
                              0, 
                              false, 
                              "Arial", 
                              40.0, 
                              prcFontEmbedding.PRC_FONT_EMBED_FULLSET, 
                              35.0,
                              (uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(255, 0, 255)), 
                              50.0, 
                              true, 
                              "Watermark");
                                                          
oProcessorHandle.Close();