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

AddSquareCircle Method

Adds a square or circle annotation to a PDF file.

Sub AddSquareCircle(From As Long,
                    To As Long,
                    Left As Double,
                    Top As Double,
                    Right As Double,
                    Bottom As Double,
                    BorderWidth As Double,
                    Text As String,
                    Author As String,
                    Subject As String,
                    IsSquare As Boolean,
                    FillColor As OLE_COLOR,
                    BorderColor As OLE_COLOR,
                    Opacity As Double)

void AddSquareCircle(int From,
                     int To,
                     double Left,
                     double Top,
                     double Right,
                     double Bottom,
                     double BorderWidth,
                     String Text,
                     String Author,
                     String Subject,
                     boolean IsSquare,
                     System.UInt32 FillColor,
                     System.UInt32 BorderColor,
                     double Opacity)

void AddSquareCircle(int From,
                     int To,
                     double Left,
                     double Top,
                     double Right,
                     double Bottom,
                     double BorderWidth,
                     string Text,
                     string Author,
                     string Subject,
                     boolean IsSquare,
                     int FillColor,
                     int BorderColor,
                     double Opacity) throws PDFProcessorException

Parameters

Return Values

N/A.

Remarks

Note 1: 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.
  3. To get page size information from a PDF file, use GetPageSize method.

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

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.AddSquareCircle(0, _
                                 0, _
                                 0, _
                                 0, _
                                 200, _
                                 300, _
                                 10, _
                                 "Note text here." + vbCR + vbCR + "Line break with CR is allowed", _
                                 "Author", _
                                 "Subject", _
                                 True, _
                                 RGB(255, 155, 0), _
                                 RGB(0, 255, 0), _
                                 30)
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.AddSquareCircle(0, _
                                    0, _
                                    0, _
                                    0, _
                                    200, _
                                    300, _
                                    10, _
                                    "Note text here." + vbCr + vbCr + "Line break with CR is allowed", _
                                    "Author", _
                                    "Subject", _
                                    True, _
                                    Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(255, 155, 0))), _
                                    Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 255, 0))), _
                                    30.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.AddSquareCircle(0,
                                    0, 
                                    0, 
                                    0, 
                                    200, 
                                    300, 
                                    10, 
                                    "Note text here.\r\rLine break is allowed", 
                                    "Author", 
                                    "Subject", 
                                    true, 
                                    (uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(255, 155, 0)), 
                                    (uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255)), 
                                    30.0);
oProcessorHandle.Close();