Aspose.Pdf

Customize the Position of Note's PopUp Window

Sometimes developers may want to specify the position and size of the note's popup window. To specify the position of the note's popup window, developers can make use of NoteWindowPositioningType property of Attachment class. This property takes one of the pre-defined values in NoteWindowPositioningType enumeration. The pre-defined values of NoteWindowPositioningType enumeration are described below for better understanding:

 

Positioning Type

Description

Auto

The popup window of note will be positioned automatically

Absolute

The popup window of note will be positioned absolutely

NoteRelative

The popup window of note will be positioned relative to the note's position

 

These positioning types of note's popup window are also explained with the help of figures given below:

 

Note1

 

Figure: Note's popup window is positioned automatically

 

Note1

 

Figure: Note's popup window is positioned absolutely

 

Note1

 

Figure: Note's popup window is positioned relative to the note

 

After setting the positioning type of the note's popup window, we can set the position of the note's popup window. NoteWindowPosition property of Attachment class is used to set the position of note's popup window.

 

The example below shows how to set note's window position using absolute positioning type.

 

Example:

 

[C#]

 

//Instantiate attachment instance by calling its empty constructor

Attachment noteAttachment = new Attachment();

 

//Add the attachment in the paragraphs collection of the section

sec1.Paragraphs.Add(noteAttachment);

 

//Set the attachment type to Note

noteAttachment.AttachmentType = AttachmentType.Note;

 

//Store some content for the note to display

noteAttachment.NoteContent =

        "This is a test for note popup window positioning.";

 

//Set the heading or title of the note

noteAttachment.NoteHeading = "Test";

 

//Set the note to be opened when PDF document is opened

noteAttachment.IsNoteOpen = true;

 

//Set the positioning type of the note's popup window to Absolute

noteAttachment.NoteWindowPositioningType = NoteWindowPositioningType.Absolute;

 

//Set the position of the note's popup window

noteAttachment.NoteWindowPosition = new RectangleArea(100,100,160,100);

 

[VB.NET]

 

'Instantiate attachment instance by calling its empty constructor

Dim noteAttachment As Attachment = New Attachment()

 

'Add the attachment in the paragraphs collection of the section

sec1.Paragraphs.Add(noteAttachment)

 

'Set the attachment type to Note

noteAttachment.AttachmentType = AttachmentType.Note

 

'Store some content for the note to display

noteAttachment.NoteContent =

         "This is a test for note popup window positioning."

 

'Set the heading or title of the note

noteAttachment.NoteHeading = "Test"

 

'Set the note to be opened when PDF document is opened

noteAttachment.IsNoteOpen = True

 

'Set the positioning type of the note's popup window to Absolute

noteAttachment.NoteWindowPositioningType = NoteWindowPositioningType.Absolute

 

'Set the position of the note's popup window

noteAttachment.NoteWindowPosition = New RectangleArea(100,100,160,100)

 

[XML]

 

<Attachment AttachmentType="Note"

   NoteContent="This is a test for note popup window positioning."

   NoteHeading="Test" IsNoteOpen="true"

   NoteWindowPositioningType="Absolute" 

   NoteWindowLeft="100" NoteWindowTop="100"

   NoteWindowWidth="160" NoteWindowHeight="100">

</Attachment>