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

AddStamp2 Method

Adds an image stamp to any page or page range of the PDF file.

Sub AddStamp2(InputImageFileName As String,
              FromPage As Long,
              ToPage As Long,
              hpos As prcStampHPosition,
              vpos As prcStampVPosition,
              zorder As prcStampZOrder,
              hoffset As Double,
              voffset As Double,
              color As OLE_COLOR,
              zoom As Double)
void AddStamp2(string InputImageFileName,
               int FromPage,
               int ToPage,
               prcStampHPosition hpos,
               prcStampVPosition vpos,
               prcStampZOrder zorder,
               double hoffset,
               double voffset,
               System.UInt32 color,
               double zoom)
void AddStamp2(String InputImageFileName,
               int FromPage,
               int ToPage,
               prcStampHPosition hpos,
               prcStampVPosition vpos,
               prcStampZOrder zorder,
               double hoffset,
               double voffset,
               int color,
               double zoom) throws PDFProcessorException

 

Parameters

Return Values

N/A.

Remarks

AddStamp2 is very closely related to AddStamp. The difference is that AddStamp can only add images to the first page or all pages of a file, whereas AddStamp2 offers full control over the page range to which the stamp is applied.

Note 1: It is very important that AddStamp2 can only make one exact color transparent. There's no tolerance.For this reason it is not recommended to use color key transparency with JPEG files, unless they are of very high quality.

Note 2: Coordinate system information:

  1. The unit size of PDF user space is 1/72 inch (1 inch = 72 PDF user space unit).
  2. The location of the origin (0, 0) is at top-left corner.

Note 3: 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 vlue in following format: 0x00bbggrr (in BGR format, not in RGB)


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

Note 4: The page number uses zero-based index, meaning that page number starts from 0.

Note 5: Supported image formats are BMP and JPEG.

Example Usage in VBScript

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf")
   oProcessorHandle.AddStamp2 "C:\test\image.jpg", _
                              0, _
                              10, _
                              PRC_STAMP_HPOS_CENTER, _
                              PRC_STAMP_VPOS_CENTER, _
                              PRC_STAMP_ZORDER_TOP, _
                              0, _
                              0, _
                              0, _
                              100
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.AddStamp2("C:\test\image.jpg", _
                              0, _
                              10, _
                              prcStampHPosition.PRC_STAMP_HPOS_CENTER, _
                              prcStampVPosition.PRC_STAMP_VPOS_CENTER, _
                              prcStampZOrder.PRC_STAMP_ZORDER_TOP, _
                              0, _
                              0, _
                              0, _
                              100.0)
oProcessorHandle.Close() 

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();


PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\output.pdf", null);
   oProcessorHandle.AddStamp2(@"C:\test\image.jpg", 
                              0, 
                              10, 
                              prcStampHPosition.PRC_STAMP_HPOS_CENTER, 
                              prcStampVPosition.PRC_STAMP_VPOS_CENTER, 
                              prcStampZOrder.PRC_STAMP_ZORDER_TOP, 
                              0, 
                              0, 
                              0, 
                              100.0);
oProcessorHandle.Close();