iTextSharp.text.Chunk.SetAnnotation C# (CSharp) Метод

SetAnnotation() публичный Метод

Sets a generic annotation to this Chunk.
public SetAnnotation ( PdfAnnotation annotation ) : Chunk
annotation iTextSharp.text.pdf.PdfAnnotation the annotation
Результат Chunk
        public Chunk SetAnnotation(PdfAnnotation annotation)
        {
            return SetAttribute(PDFANNOTATION, annotation);
        }

Usage Example

Пример #1
0
// ---------------------------------------------------------------------------    
    /**
     * Creates a PDF document.
     * @param stream Stream for the new PDF document
     */
    public void CreatePdf(Stream stream) {
      string RESOURCE = Utility.ResourcePosters;
      // step 1
      using (Document document = new Document()) {
        // step 2
        PdfWriter writer = PdfWriter.GetInstance(document, stream);
        // step 3
        document.Open();
        // step 4
        Phrase phrase;
        Chunk chunk;
        PdfAnnotation annotation;
        foreach (Movie movie in PojoFactory.GetMovies()) {
          phrase = new Phrase(movie.MovieTitle);
          chunk = new Chunk("\u00a0\u00a0");
          annotation = PdfAnnotation.CreateFileAttachment(
            writer, null,
            movie.MovieTitle, null,
            Path.Combine(RESOURCE, movie.Imdb + ".jpg"),
            string.Format("img_{0}.jpg", movie.Imdb)
          );
          annotation.Put(PdfName.NAME, new PdfString("Paperclip"));
          chunk.SetAnnotation(annotation);
          phrase.Add(chunk);
          document.Add(phrase);
          document.Add(PojoToElementFactory.GetDirectorList(movie));
          document.Add(PojoToElementFactory.GetCountryList(movie));
        }
      }
    }
All Usage Examples Of iTextSharp.text.Chunk::SetAnnotation