コード例 #1
0
 /// <summary>An associated pop-up annotation for entering or editing the text associated with this annotation.
 ///     </summary>
 /// <remarks>
 /// An associated pop-up annotation for entering or editing the text associated with this annotation.
 /// Pop-up annotation defines an associated with this annotation pop-up window that may contain text.
 /// The Contents (see
 /// <see cref="PdfAnnotation.GetContents()"/>
 /// ) entry of the annotation that has
 /// an associated popup specifies the text that shall be displayed when the pop-up window is opened.
 /// </remarks>
 /// <returns>
 /// an
 /// <see cref="PdfPopupAnnotation"/>
 /// that is associated with this annotation, or null if there is none.
 /// </returns>
 public virtual PdfPopupAnnotation GetPopup()
 {
     if (popup == null)
     {
         PdfAnnotation annotation = MakeAnnotation(GetPopupObject());
         if (!(annotation is PdfPopupAnnotation))
         {
             ILogger logger = LoggerFactory.GetLogger(typeof(iText.Kernel.Pdf.Annot.PdfMarkupAnnotation));
             logger.Warn(LogMessageConstant.POPUP_ENTRY_IS_NOT_POPUP_ANNOTATION);
             return(null);
         }
         popup = (PdfPopupAnnotation)annotation;
     }
     return(popup);
 }
コード例 #2
0
 /// <summary>Sets a pop-up annotation for entering or editing the text associated with this annotation.</summary>
 /// <remarks>
 /// Sets a pop-up annotation for entering or editing the text associated with this annotation.
 /// Pop-up annotation defines an associated with this annotation pop-up window that may contain text.
 /// The Contents (see
 /// <see cref="PdfAnnotation.SetContents(iText.Kernel.Pdf.PdfString)"/>
 /// ) entry of the annotation that has
 /// an associated popup specifies the text that shall be displayed when the pop-up window is opened.
 /// </remarks>
 /// <param name="popup">
 /// an
 /// <see cref="PdfPopupAnnotation"/>
 /// that will be associated with this annotation.
 /// </param>
 /// <returns>
 /// this
 /// <see cref="PdfMarkupAnnotation"/>
 /// instance.
 /// </returns>
 public virtual iText.Kernel.Pdf.Annot.PdfMarkupAnnotation SetPopup(PdfPopupAnnotation popup)
 {
     this.popup = popup;
     popup.SetParent(this);
     return((iText.Kernel.Pdf.Annot.PdfMarkupAnnotation)Put(PdfName.Popup, popup.GetPdfObject()));
 }
コード例 #3
0
 public static iText.Kernel.Pdf.Annot.PdfAnnotation MakeAnnotation(PdfObject pdfObject, iText.Kernel.Pdf.Annot.PdfAnnotation
                                                                   parent)
 {
     iText.Kernel.Pdf.Annot.PdfAnnotation annotation = null;
     if (pdfObject.IsIndirectReference())
     {
         pdfObject = ((PdfIndirectReference)pdfObject).GetRefersTo();
     }
     if (pdfObject.IsDictionary())
     {
         PdfDictionary dictionary = (PdfDictionary)pdfObject;
         PdfName       subtype    = dictionary.GetAsName(PdfName.Subtype);
         if (PdfName.Link.Equals(subtype))
         {
             annotation = new PdfLinkAnnotation((PdfDictionary)pdfObject);
         }
         else
         {
             if (PdfName.Popup.Equals(subtype))
             {
                 annotation = new PdfPopupAnnotation((PdfDictionary)pdfObject);
             }
             else
             {
                 if (PdfName.Widget.Equals(subtype))
                 {
                     annotation = new PdfWidgetAnnotation((PdfDictionary)pdfObject);
                 }
                 else
                 {
                     if (PdfName.Screen.Equals(subtype))
                     {
                         annotation = new PdfScreenAnnotation((PdfDictionary)pdfObject);
                     }
                     else
                     {
                         if (PdfName._3D.Equals(subtype))
                         {
                             throw new NotSupportedException();
                         }
                         else
                         {
                             if (PdfName.Highlight.Equals(subtype) || PdfName.Underline.Equals(subtype) || PdfName.Squiggly.Equals(subtype
                                                                                                                                   ) || PdfName.StrikeOut.Equals(subtype))
                             {
                                 annotation = new PdfTextMarkupAnnotation((PdfDictionary)pdfObject);
                             }
                             else
                             {
                                 if (PdfName.Caret.Equals(subtype))
                                 {
                                     annotation = new PdfCaretAnnotation((PdfDictionary)pdfObject);
                                 }
                                 else
                                 {
                                     if (PdfName.Text.Equals(subtype))
                                     {
                                         annotation = new PdfTextAnnotation((PdfDictionary)pdfObject);
                                     }
                                     else
                                     {
                                         if (PdfName.Sound.Equals(subtype))
                                         {
                                             annotation = new PdfSoundAnnotation((PdfDictionary)pdfObject);
                                         }
                                         else
                                         {
                                             if (PdfName.Stamp.Equals(subtype))
                                             {
                                                 annotation = new PdfStampAnnotation((PdfDictionary)pdfObject);
                                             }
                                             else
                                             {
                                                 if (PdfName.FileAttachment.Equals(subtype))
                                                 {
                                                     annotation = new PdfFileAttachmentAnnotation((PdfDictionary)pdfObject);
                                                 }
                                                 else
                                                 {
                                                     if (PdfName.Ink.Equals(subtype))
                                                     {
                                                         annotation = new PdfInkAnnotation((PdfDictionary)pdfObject);
                                                     }
                                                     else
                                                     {
                                                         if (PdfName.PrinterMark.Equals(subtype))
                                                         {
                                                             annotation = new PdfPrinterMarkAnnotation((PdfDictionary)pdfObject);
                                                         }
                                                         else
                                                         {
                                                             if (PdfName.TrapNet.Equals(subtype))
                                                             {
                                                                 annotation = new PdfTrapNetworkAnnotation((PdfDictionary)pdfObject);
                                                             }
                                                             else
                                                             {
                                                                 if (PdfName.FreeText.Equals(subtype))
                                                                 {
                                                                     annotation = new PdfFreeTextAnnotation((PdfDictionary)pdfObject);
                                                                 }
                                                                 else
                                                                 {
                                                                     if (PdfName.Square.Equals(subtype))
                                                                     {
                                                                         annotation = new PdfSquareAnnotation((PdfDictionary)pdfObject);
                                                                     }
                                                                     else
                                                                     {
                                                                         if (PdfName.Circle.Equals(subtype))
                                                                         {
                                                                             annotation = new PdfCircleAnnotation((PdfDictionary)pdfObject);
                                                                         }
                                                                         else
                                                                         {
                                                                             if (PdfName.Line.Equals(subtype))
                                                                             {
                                                                                 annotation = new PdfLineAnnotation((PdfDictionary)pdfObject);
                                                                             }
                                                                             else
                                                                             {
                                                                                 if (PdfName.Polygon.Equals(subtype) || PdfName.PolyLine.Equals(subtype))
                                                                                 {
                                                                                     annotation = new PdfPolyGeomAnnotation((PdfDictionary)pdfObject);
                                                                                 }
                                                                                 else
                                                                                 {
                                                                                     if (PdfName.Redact.Equals(subtype))
                                                                                     {
                                                                                         annotation = new PdfRedactAnnotation((PdfDictionary)pdfObject);
                                                                                     }
                                                                                     else
                                                                                     {
                                                                                         if (PdfName.Watermark.Equals(subtype))
                                                                                         {
                                                                                             annotation = new PdfWatermarkAnnotation((PdfDictionary)pdfObject);
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (annotation is PdfMarkupAnnotation)
     {
         PdfMarkupAnnotation markup    = (PdfMarkupAnnotation)annotation;
         PdfDictionary       inReplyTo = markup.GetInReplyToObject();
         if (inReplyTo != null)
         {
             markup.SetInReplyTo(MakeAnnotation(inReplyTo));
         }
         PdfDictionary popup = markup.GetPopupObject();
         if (popup != null)
         {
             markup.SetPopup((PdfPopupAnnotation)MakeAnnotation(popup, markup));
         }
     }
     if (annotation is PdfPopupAnnotation)
     {
         PdfPopupAnnotation popup = (PdfPopupAnnotation)annotation;
         if (parent != null)
         {
             popup.SetParent(parent);
         }
     }
     return(annotation);
 }