cete.dynamicpdf.pageelements.note
Note
- Namespace: ceTe.DynamicPDF.PageElements
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a note annotation.
public class Note : TaggablePageElement, IAnnotation, IArea, ICoordinate, ISerializable
Public Class Note
Inherits TaggablePageElement
Implements IAnnotation, IArea, ICoordinate, ISerializable
Inheritance: Object → PageElement → TaggablePageElement → Note
Implements: IAnnotation, IArea, ICoordinate, ISerializable
Examples
The following example will place an icon on the PDF that once clicked, will display text in a separate box.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a note
Dim MyNote As Note = New Note("This is my help note.", 50, 50, _
150, 50, NoteType.Help, False)
' Change the color property
MyNote.Color = RgbColor.Red
' Add the note to the page
MyPage.Elements.Add(MyNote)
MyPage.Elements.Add(New Label("Click on the above icon to view " + _
"the note.", 50, 80, 150, 72, Font.HelveticaBold, 18))
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create a note
Note note = new Note("This is my help note.", 50, 50, 150, 50,
NoteType.Help, true);
// Change the color property
note.Color = RgbColor.Red;
// Add the note to the page
page.Elements.Add(note);
page.Elements.Add(new Label("Click on the above icon to view " +
"the note.", 50, 80, 150, 72, Font.HelveticaBold, 18));
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to place a note annotation on the PDF.
Constructors
Note(String, Single, Single, Single, Single)
Initializes a new instance of the Note class.
public Note(string text, float x, float y, float width, float height)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single)
Parameters
- text: String
Text of the note.
- x: Single
X coordinate of the note.
- y: Single
Y coordinate of the note.
- width: Single
Width of the note.
- height: Single
Height of the note.
Note(String, Single, Single, Single, Single, Boolean)
Initializes a new instance of the Note class.
public Note(string text, float x, float y, float width, float height, bool isOpen)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, isOpen As Boolean)
Parameters
- text: String
Text of the note.
- x: Single
X coordinate of the note.
- y: Single
Y coordinate of the note.
- width: Single
Width of the note.
- height: Single
Height of the note.
- isOpen: Boolean
Specifies if the note is open initially.
Note(String, Single, Single, Single, Single, NoteType)
Initializes a new instance of the Note class.
public Note(string text, float x, float y, float width, float height, NoteType type)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, type As NoteType)
Parameters
- text: String
Text of the note.
- x: Single
X coordinate of the note.
- y: Single
Y coordinate of the note.
- width: Single
Width of the note.
- height: Single
Height of the note.
- type: NoteType
Specifies the type of note.
Note(String, Single, Single, Single, Single, NoteType, Boolean)
Initializes a new instance of the Note class.
public Note(string text, float x, float y, float width, float height, NoteType type, bool isOpen)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, type As NoteType, isOpen As Boolean)
Parameters
- text: String
Text of the note.
- x: Single
X coordinate of the note.
- y: Single
Y coordinate of the note.
- width: Single
Width of the note.
- height: Single
Height of the note.
- type: NoteType
Specifies the type of note.
- isOpen: Boolean
Specifies if the note is open initially.
Properties
Author
Gets or sets the author of the note.
public string Author { get; set; }
Public Property Author As String
Property Value
Examples
This example show how add Note with an Author
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModuleSub NoteWithAuthor(outputPath As String)
'Create a PDF Document
Dim document As Document = New Document()
'Create a Page and add it to the document
Dim page As Page = New Page()
document.Pages.Add(page)
'Create a note and add Author
Dim note As Note = New Note("This is my help note.", 10, 100, 10, 100)
note.Author = "Cete Software"
'Add the note to the page
page.Elements.Add(note)
'Save the pdf
document.Draw(outputPath)
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{public static void NoteWithAuthor(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create a note and add Author
Note note = new Note("This is my help note.", 10, 100, 10, 100);
note.Author = "Cete Software";
// Add the note to the page
page.Elements.Add(note);
// Save the pdf
document.Draw(outputPath);
}
}
Color
Gets or sets the color of the note.
public RgbColor Color { get; set; }
Public Property Color As RgbColor
Property Value
Height
Gets or sets the height of the link.
public float Height { get; set; }
Public Property Height As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
IgnoreMargins
Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement)
public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean
Property Value
Examples
The following example will place the Label in the top-left of the page with IgnoreMargin
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
IsOpen
Gets or sets a value indicating if the note is opened by default.
public bool IsOpen { get; set; }
Public Property IsOpen As Boolean
Property Value
NoteType
Gets or sets the type of note.
public NoteType NoteType { get; set; }
Public Property NoteType As NoteType
Property Value
RelativeTo
Gets and sets placement of the page element on the page. (Inherited from PageElement)
public RelativeTo RelativeTo { get; set; }
Public Property RelativeTo As RelativeTo
Property Value
Examples
The following example will place the Label in the top-left of the page.
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
Tag
Gets or sets the structure element of the note.
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
Text
Gets or sets the text of the note.
public string Text { get; set; }
Public Property Text As String
Property Value
Width
Gets or sets the width of the link.
public float Width { get; set; }
Public Property Width As Single
Property Value
X
Gets or sets the X coordinate of the link.
public float X { get; set; }
Public Property X As Single
Property Value
Y
Gets or sets the Y coordinate of the link.
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the link to the given PageWriter object.
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the link's output.
DrawAnnotation(DocumentWriter)
Draws the link to the given DocumentWriter object.
public void DrawAnnotation(DocumentWriter writer)
Sub DrawAnnotation(writer As DocumentWriter)
Parameters
- writer: DocumentWriter
DocumentWriter object to receive the link's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .