示例#1
0
 /*
  * end inner class
  */
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     // step 1
     using (Document document = new Document())
     {
         // step 2
         PdfWriter   writer = PdfWriter.GetInstance(document, stream);
         GenericTags gevent = new GenericTags();
         writer.PageEvent = gevent;
         writer.PageEvent = new ParagraphPositions();
         // step 3
         document.Open();
         // step 4
         Font bold   = new Font(Font.FontFamily.HELVETICA, 11, Font.BOLD);
         Font italic = new Font(Font.FontFamily.HELVETICA, 11, Font.ITALIC);
         Font white  = new Font(
             Font.FontFamily.HELVETICA, 12,
             Font.BOLD | Font.ITALIC,
             BaseColor.WHITE
             );
         Paragraph p;
         Chunk     c;
         foreach (Movie movie in PojoFactory.GetMovies(true))
         {
             p = new Paragraph(22);
             c = new Chunk(String.Format("{0} ", movie.Year), bold);
             c.SetGenericTag("strip");
             p.Add(c);
             c = new Chunk(movie.MovieTitle);
             c.SetGenericTag(movie.Year.ToString());
             p.Add(c);
             c = new Chunk(
                 String.Format(" ({0} minutes)  ", movie.Duration),
                 italic
                 );
             p.Add(c);
             c = new Chunk("IMDB", white);
             c.SetAnchor("http://www.imdb.com/title/tt" + movie.Imdb);
             c.SetGenericTag("ellipse");
             p.Add(c);
             document.Add(p);
         }
         document.NewPage();
         writer.PageEvent = null;
         foreach (string entry in gevent.years.Keys)
         {
             p = new Paragraph(String.Format(
                                   "{0}: {1} movie(s)", entry, gevent.years[entry]
                                   ));
             document.Add(p);
         }
     }
 }
示例#2
0
/*
 * end inner class
*/
// ---------------------------------------------------------------------------
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document()) {
      // step 2
        PdfWriter writer = PdfWriter.GetInstance(document, stream);
        GenericTags gevent = new GenericTags();
        writer.PageEvent = gevent;
        writer.PageEvent = new ParagraphPositions();       
        // step 3
        document.Open();
        // step 4
        Font bold = new Font(Font.FontFamily.HELVETICA, 11, Font.BOLD);
        Font italic = new Font(Font.FontFamily.HELVETICA, 11, Font.ITALIC);
        Font white = new Font(
          Font.FontFamily.HELVETICA, 12, 
          Font.BOLD | Font.ITALIC, 
          BaseColor.WHITE
        );
        Paragraph p;
        Chunk c;        
        foreach (Movie movie in PojoFactory.GetMovies(true)) {
            p = new Paragraph(22);
            c = new Chunk(String.Format("{0} ", movie.Year), bold);
            c.SetGenericTag("strip");
            p.Add(c);
            c = new Chunk(movie.MovieTitle);
            c.SetGenericTag(movie.Year.ToString());
            p.Add(c);
            c = new Chunk(
              String.Format(" ({0} minutes)  ", movie.Duration), 
              italic
            );
            p.Add(c);
            c = new Chunk("IMDB", white);
            c.SetAnchor("http://www.imdb.com/title/tt" + movie.Imdb);
            c.SetGenericTag("ellipse");
            p.Add(c);
            document.Add(p);
        }
        document.NewPage();
        writer.PageEvent = null;
        foreach (string entry in gevent.years.Keys) {
          p = new Paragraph(String.Format(
            "{0}: {1} movie(s)", entry, gevent.years[entry]
          ));
          document.Add(p);
        }
      }
    }