예제 #1
1
// ---------------------------------------------------------------------------
    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);
      }
    }
예제 #2
0
// ---------------------------------------------------------------------------
    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);       
      }
    }
예제 #3
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);
      }
   }
예제 #4
0
// ---------------------------------------------------------------------------    
    public void Write(Stream stream) {
      using (ZipFile zip = new ZipFile()) { 
        MovieTemplates m = new MovieTemplates();
        byte[] pdf = Utility.PdfBytes(m); 
        zip.AddEntry(RESULT, new NamedActions().ManipulatePdf(pdf)); 
        zip.AddEntry(Utility.ResultFileName(m.ToString() + ".pdf"), pdf);
        zip.Save(stream);             
      }
    }
예제 #5
0
// --------------------------------------------------------------------------- 
    public override void Write(Stream stream) {
      using (ZipFile zip = new ZipFile()) {
        MovieTemplates m = new MovieTemplates(); 
        byte[] pdf = Utility.PdfBytes(m);
        TimetableAnnotations2 t = new TimetableAnnotations2();
        zip.AddEntry(RESULT, t.ManipulatePdf(pdf));
        zip.AddEntry(Utility.ResultFileName(m.ToString() + ".pdf"), pdf);
        zip.Save(stream);             
      }
    }
예제 #6
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);             
      }
    }    
예제 #7
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);             
      }    
    }