// --------------------------------------------------------------------------- public void Write(Stream stream) { using (ZipFile zip = new ZipFile()) { // previous example Stationery s = new Stationery(); StampStationery ss = new StampStationery(); byte[] stationery = s.CreateStationary(); byte[] sStationery = ss.CreatePdf(); zip.AddEntry(RESULT, ManipulatePdf(sStationery, stationery)); zip.AddEntry(ORIGINAL, sStationery); zip.AddEntry(Utility.ResultFileName(s.ToString() + ".pdf"), stationery); zip.Save(stream); } }
// --------------------------------------------------------------------------- public void Write(Stream stream) { using (ZipFile zip = new ZipFile()) { Stationery s = new Stationery(); StampStationery ss = new StampStationery(); byte[] stationery = s.CreateStationary(); byte[] sStationery = ss.ManipulatePdf( ss.CreatePdf(), stationery ); byte[] insertPages = ManipulatePdf(sStationery, stationery); zip.AddEntry(RESULT1, insertPages); // reorder the pages in the PDF PdfReader reader = new PdfReader(insertPages); reader.SelectPages("3-41,1-2"); using (MemoryStream ms = new MemoryStream()) { using (PdfStamper stamper = new PdfStamper(reader, ms)) { } zip.AddEntry(RESULT2, ms.ToArray()); } zip.AddEntry(Utility.ResultFileName(s.ToString() + ".pdf"), stationery); zip.AddEntry(Utility.ResultFileName(ss.ToString() + ".pdf"), sStationery); zip.Save(stream); } }