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

AddWatermark Method

Add watermark

Sub AddWatermark(InputFileName As String,
                 OutputFileName As String,
                 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(string InputFileName,
                  string OutputFileName,
                  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(String InputFileName,
                  String OutputFileName,
                  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

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
 
oProcessor.AddWatermark "C:\test\input.pdf", _
                        "C:\test\output.pdf", _
                        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"