private static void CreateAnnotations(PdfDocumentProcessor processor) { //Add a text markup annotation at the first page: PdfDocumentPosition startPosition = new PdfDocumentPosition(1, new PdfPoint(113, 224)); PdfDocumentPosition endPosition = new PdfDocumentPosition(1, new PdfPoint(272, 207)); PdfTextMarkupAnnotationData textMarkupAnnotation = processor.AddTextMarkupAnnotation(startPosition, endPosition, PdfTextMarkupAnnotationType.Highlight); if (textMarkupAnnotation != null) { //Specify the annotation properties: textMarkupAnnotation.Author = "Bill Smith"; textMarkupAnnotation.Subject = "Important!"; textMarkupAnnotation.Contents = "Please, fact-check this diagram"; textMarkupAnnotation.Color = new PdfRGBColor(0.10, 0.85, 1.00); AddAnnotationComments(textMarkupAnnotation); } //Add a sticky note at the first page: PdfTextAnnotationData textAnnotation = processor.AddTextAnnotation(1, new PdfPoint(64, 65)); //Specify the annotation parameters: textAnnotation.Author = "Nancy Davolio"; textAnnotation.Color = new PdfRGBColor(0.8, 0.2, 0.1); textAnnotation.Contents = "Please proofread this document"; textAnnotation.IconName = PdfTextAnnotationIconName.Check; AddAnnotationComments(textAnnotation); }
void pdfViewer1_MouseMove(object sender, MouseEventArgs e) { if (mouseButtonPressed) { endPosition = pdfViewer1.GetDocumentPosition(e.Location); pdfViewer1.Invalidate(); } }
void pdfViewer1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { startPosition = pdfViewer1.GetDocumentPosition(e.Location); endPosition = null; mouseButtonPressed = true; pdfViewer1.Invalidate(); } }
void pdfViewer_MouseClick(object sender, MouseEventArgs e) { PdfDocumentPosition position = pdfViewer.GetDocumentPosition(e.Location, true); MessageBox.Show(string.Format("You clicked on page {0}", position.PageNumber)); }