internal ByteStore(PRStream str) { md5 = new MD5CryptoServiceProvider(); ByteBuffer bb = new ByteBuffer(); int level = 100; SerObject(str, level, bb); this.b = bb.ToByteArray(); md5 = null; }
/** * Translate a PRStream to a PdfStream. The data part copies itself. */ protected PdfStream CopyStream(PRStream inp) { PRStream outp = new PRStream(inp, null); foreach (PdfName key in inp.Keys) { PdfObject value = inp.Get(key); outp.Put(key, CopyObject(value)); } return(outp); }
/** * Gets the content stream of a page as a PdfStream object. * @param pageNumber the page of which you want the stream * @param compressionLevel the compression level you want to apply to the stream * @return a PdfStream object * @since 2.1.3 (the method already existed without param compressionLevel) */ internal PdfStream GetFormXObject(int pageNumber, int compressionLevel) { PdfDictionary page = reader.GetPageNRelease(pageNumber); PdfObject contents = PdfReader.GetPdfObjectRelease(page.Get(PdfName.CONTENTS)); PdfDictionary dic = new PdfDictionary(); byte[] bout = null; if (contents != null) { if (contents.IsStream()) { dic.Merge((PRStream)contents); } else { bout = reader.GetPageContent(pageNumber, file); } } else { bout = new byte[0]; } dic.Put(PdfName.RESOURCES, PdfReader.GetPdfObjectRelease(page.Get(PdfName.RESOURCES))); dic.Put(PdfName.TYPE, PdfName.XOBJECT); dic.Put(PdfName.SUBTYPE, PdfName.FORM); PdfImportedPage impPage = (PdfImportedPage)importedPages[pageNumber]; dic.Put(PdfName.BBOX, new PdfRectangle(impPage.BoundingBox)); PdfArray matrix = impPage.Matrix; if (matrix == null) { dic.Put(PdfName.MATRIX, IDENTITYMATRIX); } else { dic.Put(PdfName.MATRIX, matrix); } dic.Put(PdfName.FORMTYPE, ONE); PRStream stream; if (bout == null) { stream = new PRStream((PRStream)contents, dic); } else { stream = new PRStream(reader, bout); stream.Merge(dic); } return(stream); }
public PRStream(PRStream stream, PdfDictionary newDic) { reader = stream.reader; offset = stream.offset; length = stream.Length; compressed = stream.compressed; compressionLevel = stream.compressionLevel; streamBytes = stream.streamBytes; bytes = stream.bytes; objNum = stream.objNum; objGen = stream.objGen; if (newDic != null) Merge(newDic); else Merge(stream); }
public PRStream(PRStream stream, PdfDictionary newDic) { reader = stream.reader; offset = stream.offset; length = stream.Length; compressed = stream.compressed; compressionLevel = stream.compressionLevel; streamBytes = stream.streamBytes; bytes = stream.bytes; objNum = stream.objNum; objGen = stream.objGen; if (newDic != null) { Merge(newDic); } else { Merge(stream); } }
public PRStream(PRStream stream, PdfDictionary newDic, PdfReader reader) : this(stream, newDic) { this.reader = reader; }
/** * Translate a PRStream to a PdfStream. The data part copies itself. */ protected PdfStream CopyStream(PRStream inp) { PRStream outp = new PRStream(inp, null); foreach (PdfName key in inp.Keys) { PdfObject value = inp.Get(key); outp.Put(key, CopyObject(value)); } return outp; }
/** * Gets the content stream of a page as a PdfStream object. * @param pageNumber the page of which you want the stream * @param compressionLevel the compression level you want to apply to the stream * @return a PdfStream object * @since 2.1.3 (the method already existed without param compressionLevel) */ internal PdfStream GetFormXObject(int pageNumber, int compressionLevel) { PdfDictionary page = reader.GetPageNRelease(pageNumber); PdfObject contents = PdfReader.GetPdfObjectRelease(page.Get(PdfName.CONTENTS)); PdfDictionary dic = new PdfDictionary(); byte[] bout = null; if (contents != null) { if (contents.IsStream()) dic.Merge((PRStream)contents); else bout = reader.GetPageContent(pageNumber, file); } else bout = new byte[0]; dic.Put(PdfName.RESOURCES, PdfReader.GetPdfObjectRelease(page.Get(PdfName.RESOURCES))); dic.Put(PdfName.TYPE, PdfName.XOBJECT); dic.Put(PdfName.SUBTYPE, PdfName.FORM); PdfImportedPage impPage = (PdfImportedPage)importedPages[pageNumber]; dic.Put(PdfName.BBOX, new PdfRectangle(impPage.BoundingBox)); PdfArray matrix = impPage.Matrix; if (matrix == null) dic.Put(PdfName.MATRIX, IDENTITYMATRIX); else dic.Put(PdfName.MATRIX, matrix); dic.Put(PdfName.FORMTYPE, ONE); PRStream stream; if (bout == null) { stream = new PRStream((PRStream)contents, dic); } else { stream = new PRStream(reader, bout); stream.Merge(dic); } return stream; }