Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Annotations
PDFPAGE_SetAnnotation

See Also Example
Collapse All

This function creates a color information annotation on the current PDF page.

Syntax

LONG PDFPAGE_SetAnnotation (
DOUBLE left,
DOUBLE top,
DOUBLE right,
DOUBLE bottom,
BSTR title,
BSTR contents,
OLE_COLOR color,
VARIANT_BOOL print,
VARIANT_BOOL noZoom,
VARIANT_BOOL noRotate,
VARIANT_BOOL invisible,
VARIANT_BOOL hidden,
VARIANT_BOOL noView,
VARIANT_BOOL readOnly,
VARIANT_BOOL opened,
TxFontCharset fontCharset
)
Parameters
left
X coordinate of the top-left corner of the bounding rectangle

top
Y coordinate of the top-left corner of the bounding rectangle

right
X coordinate of the bottom-right corner of the bounding rectangle

bottom
Y coordinate of the bottom-right corner of the bounding rectangle

title
Title of the annotation

contents
Contents of the annotation

color
Background color of the annotation

print
Prints the annotation with the page if set to VARIANT_TRUE

noZoom
Does not zoom the annotation with the page if set to VARIANT_TRUE

noRotate
Does not rotate the annotation with the page if set to VARIANT_TRUE

invisible
Makes the annotation invisible if set to VARIANT_TRUE

hidden
Hides the annotation if set to VARIANT_TRUE

noView
Does not permit viewing the annotation if set to VARIANT_TRUE

readOnly
Makes the annotation read-only if set to VARIANT_TRUE

opened
Opens the annotation if set to VARIANT_TRUE

fontCharset
Character set (code page) of the annotation

Return value
Index of the annotation

Remarks

PDFPAGE_SetAnnotation inserts a colored, text annotation into the current page in the area bounded by the coordinates specified. The strings title and text set the title and content of the annotation. color specifies the color of the annotation icon and borders. Additional flags can describe annotation window characteristics, such as visibility, zoom, read-only, printability, and rotatability (AnnotationFlag_afPrint, AnnotationFlag_afNoZoom, AnnotationFlag_afNoRotate, AnnotationFlag_afInvisible, AnnotationFlag_afHidden, AnnotationFlag_afNoView, AnnotationFlag_afReadOnly). The opened parameter creates an annotation that is opened at startup. fontCharset specifies the code page for annotation text. OLE_COLOR type contains the value of any RGB color.

The return value is an annotation/control identifier in document's annotations collection and can be used in AddControlToAction, CurrentAnnotationIndex.

Equivalent in new interface: IPDFDocument4::AddTextAnnotation, IPDFDocument4::AddUnicodeTextAnnotation.

Example

Creating a Text Annotation

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
PDF.PDFPAGE_SetAnnotation(100, 200, 110, 210, 'Title',
    'Here goes annotation contents...', 255, false, false, false,
    false, false, false, true, true, charsetANSI_CHARSET);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->PDFPAGE_SetAnnotation(100, 200, 110, 210, "Title",
    "Here goes annotation contents...", 255, FALSE, FALSE, FALSE,
    FALSE, FALSE, FALSE, TRUE, TRUE, charsetANSI_CHARSET);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.PDFPAGE_SetAnnotation(100, 200, 110, 210, "Title",
    "Here goes annotation contents...", 255, false, false, false,
    false, false, false, true, true, TxFontCharset.charsetANSI_CHARSET);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
PDF.PDFPAGE_SetAnnotation 100, 200, 110, 210, "Title",_
    "Here goes annotation contents...", 255, false, false, false,
    false, false, false, true, true, 0
PDF.EndDoc

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots