// --------------------------------------------------------------------------- public void Write(Stream stream) { using (ZipFile zip = new ZipFile()) { ImageTypes it = new ImageTypes(); zip.AddEntry(RESULT, it.CreatePdf()); /* * uncomment if you want to see the image files in the zip archive; * some of them are semi-large files * for (int i = 0; i < RESOURCES.Length; i++) { zip.AddFile(Path.Combine(Utility.ResourceImage, RESOURCES[i]), ""); } zip.AddFile(Path.Combine(Utility.ResourceImage, RESOURCE), ""); */ zip.Save(stream); } }
// --------------------------------------------------------------------------- public void Write(Stream stream) { using (ZipFile zip = new ZipFile()) { ImageTypes it = new ImageTypes(); zip.AddEntry(RESULT, it.CreatePdf()); /* * uncomment if you want to see the image files in the zip archive; * some of them are semi-large files * * for (int i = 0; i < RESOURCES.Length; i++) { * zip.AddFile(Path.Combine(Utility.ResourceImage, RESOURCES[i]), ""); * } * zip.AddFile(Path.Combine(Utility.ResourceImage, RESOURCE), ""); */ zip.Save(stream); } }
// =========================================================================== 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); } }