Example #1
0
// ===========================================================================
    public void Write(Stream stream) {
      ImageTypes it = new ImageTypes();
      using (ZipFile zip = new ZipFile()) {
        byte[] pdf = it.CreatePdf();
        zip.AddEntry(Utility.ResultFileName(it.ToString() + ".pdf"), pdf);
        PdfReader reader = new PdfReader(pdf);
        PdfReaderContentParser parser = new PdfReaderContentParser(reader);
        MyImageRenderListener listener = new MyImageRenderListener();
        for (int i = 1; i <= reader.NumberOfPages; i++) {
          parser.ProcessContent(i, listener);
        } 
        for (int i = 0; i < listener.MyImages.Count; ++i) {
          zip.AddEntry(
            listener.ImageNames[i],
            listener.MyImages[i]
          );
        }         
        zip.Save(stream);
      }
    }
Example #2
0
// ===========================================================================
        public void Write(Stream stream)
        {
            ImageTypes it = new ImageTypes();

            using (ZipFile zip = new ZipFile()) {
                byte[] pdf = it.CreatePdf();
                zip.AddEntry(Utility.ResultFileName(it.ToString() + ".pdf"), pdf);
                PdfReader reader = new PdfReader(pdf);
                PdfReaderContentParser parser   = new PdfReaderContentParser(reader);
                MyImageRenderListener  listener = new MyImageRenderListener();
                for (int i = 1; i <= reader.NumberOfPages; i++)
                {
                    parser.ProcessContent(i, listener);
                }
                for (int i = 0; i < listener.MyImages.Count; ++i)
                {
                    zip.AddEntry(
                        listener.ImageNames[i],
                        listener.MyImages[i]
                        );
                }
                zip.Save(stream);
            }
        }