public virtual void GetAnnotationSetAsIntsTest()
 {
     using (PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()))) {
         int       pageNumber      = 1;
         int       annotationIndex = 0;
         PdfTarget target          = PdfTarget.CreateChildTarget(pageNumber, annotationIndex);
         PdfFileAttachmentAnnotation annotation = new PdfFileAttachmentAnnotation(new Rectangle(0, 0, 20, 20));
         document.AddNewPage();
         document.GetPage(1).AddAnnotation(annotation);
         NUnit.Framework.Assert.AreEqual(annotation.GetPdfObject(), target.GetAnnotation(document).GetPdfObject());
     }
 }
 public virtual void GetAnnotationSetAsStringNotAvailableTest()
 {
     using (PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()))) {
         String    namedDestination     = "namedDestination";
         String    annotationIdentifier = "annotationIdentifier";
         PdfTarget target = PdfTarget.CreateChildTarget(namedDestination, annotationIdentifier);
         document.AddNewPage();
         document.GetCatalog().GetNameTree(PdfName.Dests).AddEntry(namedDestination, new PdfArray(new PdfNumber(1))
                                                                   );
         PdfAnnotation annotation = target.GetAnnotation(document);
         NUnit.Framework.Assert.IsNull(annotation);
     }
 }
 public virtual void GetAnnotationSetAsAnnotationTest()
 {
     using (PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()))) {
         PdfFileAttachmentAnnotation annotation = new PdfFileAttachmentAnnotation(new Rectangle(0, 0, 20, 20));
         document.AddNewPage();
         document.GetPage(1).AddAnnotation(annotation);
         PdfDictionary content = new PdfDictionary();
         content.Put(new PdfName("Key"), new PdfString("Value"));
         PdfTarget target = PdfTarget.Create(new PdfDictionary());
         target.SetAnnotation(annotation, document);
         NUnit.Framework.Assert.AreEqual(annotation.GetPdfObject(), target.GetAnnotation(document).GetPdfObject());
     }
 }
 public virtual void GetAnnotationSetAsStringTest()
 {
     using (PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()))) {
         String    namedDestination     = "namedDestination";
         String    annotationIdentifier = "annotationIdentifier";
         PdfTarget target = PdfTarget.CreateChildTarget(namedDestination, annotationIdentifier);
         PdfFileAttachmentAnnotation annotation = new PdfFileAttachmentAnnotation(new Rectangle(0, 0, 20, 20));
         annotation.SetName(new PdfString(annotationIdentifier));
         document.AddNewPage();
         document.GetPage(1).AddAnnotation(annotation);
         document.GetCatalog().GetNameTree(PdfName.Dests).AddEntry(namedDestination, new PdfArray(new PdfNumber(1))
                                                                   );
         PdfAnnotation retrievedAnnotation = target.GetAnnotation(document);
         NUnit.Framework.Assert.AreEqual(annotation.GetPdfObject(), retrievedAnnotation.GetPdfObject());
     }
 }