コード例 #1
0
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     // Use old example to create PDF
     MovieTemplates mt = new MovieTemplates();
     byte[] pdf = Utility.PdfBytes(mt);
     using (ZipFile zip = new ZipFile())
     {
         using (MemoryStream ms = new MemoryStream())
         {
             // step 1
             using (Document document = new Document())
             {
                 // step 2
                 PdfWriter writer = PdfWriter.GetInstance(document, ms);
                 // step 3
                 document.Open();
                 // step 4
                 PdfPTable table = new PdfPTable(2);
                 PdfReader reader = new PdfReader(pdf);
                 int n = reader.NumberOfPages;
                 PdfImportedPage page;
                 for (int i = 1; i <= n; i++)
                 {
                     page = writer.GetImportedPage(reader, i);
                     table.AddCell(Image.GetInstance(page));
                 }
                 document.Add(table);
             }
             zip.AddEntry(RESULT, ms.ToArray());
         }
         zip.AddEntry(Utility.ResultFileName(mt.ToString() + ".pdf"), pdf);
         zip.Save(stream);
     }
 }
コード例 #2
0
// --------------------------------------------------------------------------- 
    public void Write(Stream stream) {
      using (ZipFile zip = new ZipFile()) {
        MovieTemplates m = new MovieTemplates();
        byte[] pdf = Utility.PdfBytes(m);
        zip.AddEntry(Utility.ResultFileName(m.ToString() + ".pdf"), pdf); 
        CropPages c = new CropPages();      
        zip.AddEntry(RESULT, c.ManipulatePdf(pdf));       
        zip.Save(stream);             
      }
    }
コード例 #3
0
 // ---------------------------------------------------------------------------
 public virtual void Write(Stream stream)
 {
     using (ZipFile zip = new ZipFile())
     {
         MovieTemplates m = new MovieTemplates();
         byte[] pdf = Utility.PdfBytes(m);
         TimetableAnnotations1 t = new TimetableAnnotations1();
         zip.AddEntry(RESULT, t.ManipulatePdf(pdf));
         zip.AddEntry(Utility.ResultFileName(m.ToString() + ".pdf"), pdf);
         zip.Save(stream);
     }
 }
コード例 #4
0
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     using (ZipFile zip = new ZipFile())
     {
         MovieTemplates m = new MovieTemplates();
         byte[] pdf = Utility.PdfBytes(m);
         PrintTimeTable p = new PrintTimeTable();
         zip.AddEntry(RESULT, p.ManipulatePdf(pdf));
         zip.AddEntry(RESOURCE, p.jsString);
         zip.AddEntry(Utility.ResultFileName(m.ToString() + ".pdf"), pdf);
         zip.Save(stream);
     }
 }
コード例 #5
0
 // ---------------------------------------------------------------------------      
 public void Write(Stream stream)
 {
     using (ZipFile zip = new ZipFile())
     {
         MovieTemplates m = new MovieTemplates();
         byte[] pdf = Utility.PdfBytes(m);
         BookmarkedTimeTable b = new BookmarkedTimeTable();
         byte[] bttBytes = b.ManipulatePdf(pdf);
         MovieHistory mh = new MovieHistory();
         byte[] mhBytes = Utility.PdfBytes(mh);
         List<byte[]> src = new List<byte[]>() { bttBytes, mhBytes };
         ConcatenateBookmarks cb = new ConcatenateBookmarks();
         zip.AddEntry(RESULT, cb.ManipulatePdf(src));
         zip.AddEntry(Utility.ResultFileName(b.ToString() + ".pdf"), bttBytes);
         zip.AddEntry(Utility.ResultFileName(mh.ToString() + ".pdf"), mhBytes);
         zip.Save(stream);
     }
 }
コード例 #6
0
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     MovieTemplates mt = new MovieTemplates();
     byte[] pdf = Utility.PdfBytes(mt);
     PdfReader reader = new PdfReader(pdf);
     using (ZipFile zip = new ZipFile())
     {
         reader.SelectPages("4-8");
         zip.AddEntry(RESULT1, ManipulateWithStamper(reader));
         /*
          * can't figure out __WHY__, but if i don't reset the reader the example
          * will __NOT__ work!
          */
         reader = new PdfReader(pdf);
         reader.SelectPages("4-8");
         zip.AddEntry(RESULT2, ManipulateWithCopy(reader));
         zip.AddEntry(Utility.ResultFileName(mt.ToString() + ".pdf"), pdf);
         zip.Save(stream);
     }
 }
コード例 #7
0
ファイル: Burst.cs プロジェクト: kuujinbo/iTextInAction2Ed
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     // use one of the previous examples to create a PDF
     MovieTemplates mt = new MovieTemplates();
     // Create a reader
     byte[] pdf = Utility.PdfBytes(mt);
     PdfReader reader = new PdfReader(pdf);
     // loop over all the pages in the original PDF
     int n = reader.NumberOfPages;
     using (ZipFile zip = new ZipFile())
     {
         for (int i = 0; i < n; )
         {
             string dest = string.Format(RESULT, ++i);
             using (MemoryStream ms = new MemoryStream())
             {
                 // We'll create as many new PDFs as there are pages
                 // step 1
                 using (Document document = new Document())
                 {
                     // step 2
                     using (PdfCopy copy = new PdfCopy(document, ms))
                     {
                         // step 3
                         document.Open();
                         // step 4
                         copy.AddPage(copy.GetImportedPage(reader, i));
                     }
                 }
                 zip.AddEntry(dest, ms.ToArray());
             }
         }
         zip.AddEntry(Utility.ResultFileName(mt.ToString() + ".pdf"), pdf);
         zip.Save(stream);
     }
 }
コード例 #8
0
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     using (ZipFile zip = new ZipFile()) {
     MovieTemplates m = new MovieTemplates();
     byte[] mPdf = Utility.PdfBytes(m);
     zip.AddEntry(Utility.ResultFileName(m.ToString() + ".pdf"), mPdf);
     InspectPageContent i = new InspectPageContent();
     zip.AddEntry(RESULT, i.InspectPdf(mPdf));
     zip.Save(stream);
       }
 }