// ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     using (ZipFile zip = new ZipFile())
     {
         HelloWorld h = new HelloWorld();
         byte[] pdf = Utility.PdfBytes(h);
         // Create a reader
         PdfReader reader = new PdfReader(pdf);
         string js = File.ReadAllText(
           Path.Combine(Utility.ResourceJavaScript, RESOURCE)
         );
         using (MemoryStream ms = new MemoryStream())
         {
             using (PdfStamper stamper = new PdfStamper(reader, ms))
             {
                 // Add some javascript
                 stamper.JavaScript = js;
             }
             zip.AddEntry(RESULT, ms.ToArray());
         }
         zip.AddEntry(RESOURCE, js);
         zip.AddEntry(Utility.ResultFileName(h.ToString() + ".pdf"), pdf);
         zip.Save(stream);
     }
 }
Пример #2
0
// --------------------------------------------------------------------------- 
    public void Write(Stream stream) {
      using (ZipFile zip = new ZipFile()) {
        HelloWorld h = new HelloWorld();
        byte[] pdf = Utility.PdfBytes(h);
        zip.AddEntry(Utility.ResultFileName(h.ToString() + ".pdf"), pdf);       
        AppendMode a = new AppendMode();      
        zip.AddEntry(RESULT, a.ManipulatePdf(pdf));       
        zip.Save(stream);             
      }
    }
Пример #3
0
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     HelloWorld hello = new HelloWorld();
       Hero1 hero = new Hero1();
       using (ZipFile zip = new ZipFile()) {
     byte[] pdfHello = Utility.PdfBytes(hello);
     byte[] pdfHero = Utility.PdfBytes(hero);
     zip.AddEntry(Utility.ResultFileName(
       hello.ToString() + ".pdf"), pdfHello
     );
     zip.AddEntry(Utility.ResultFileName(
       hero.ToString() + ".pdf"), pdfHero
     );
     GetContentStream example = new GetContentStream();
     zip.AddEntry(RESULT1, example.ReadContent(pdfHello));
     zip.AddEntry(RESULT2, example.ReadContent(pdfHero));
     zip.Save(stream);
       }
 }
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     using (ZipFile zip = new ZipFile())
     {
         ParsingHelloWorld example = new ParsingHelloWorld();
         byte[] ePdf = example.CreatePdf();
         zip.AddEntry(PDF, ePdf);
         HelloWorld hello = new HelloWorld();
         byte[] hPdf = Utility.PdfBytes(hello);
         zip.AddEntry(Utility.ResultFileName(hello.ToString() + ".pdf"), hPdf);
         zip.AddEntry(TEXT1, example.ParsePdf(hPdf));
         zip.AddEntry(TEXT2, example.ParsePdf(ePdf));
         zip.AddEntry(TEXT3, example.ExtractText(ePdf));
         zip.Save(stream);
     }
 }