iTextSharp.text.pdf.PdfContents.PdfContents C# (CSharp) Метод

PdfContents() приватный Метод

private PdfContents ( PdfContentByte under, PdfContentByte content, PdfContentByte text, PdfContentByte secondContent, Rectangle page ) : System
under PdfContentByte
content PdfContentByte
text PdfContentByte
secondContent PdfContentByte
page iTextSharp.text.Rectangle
Результат System
        internal PdfContents(PdfContentByte under, PdfContentByte content, PdfContentByte text, PdfContentByte secondContent, Rectangle page)
            : base()
        {
            Stream ostr = null;
            streamBytes = new MemoryStream();
            if (Document.Compress) {
                compressed = true;
                int compresLevel;
                if (text != null)
                    compresLevel = text.PdfWriter.CompressionLevel;
                else
                    compresLevel = content.PdfWriter.CompressionLevel;
                ostr = new ZDeflaterOutputStream(streamBytes, compresLevel);
            }
            else
                ostr = streamBytes;
            int rotation = page.Rotation;
            byte[] tmp;
            switch (rotation) {
                case 90:
                    ostr.Write(ROTATE90, 0, ROTATE90.Length);
                    tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Top));
                    ostr.Write(tmp, 0, tmp.Length);
                    ostr.WriteByte((byte)' ');
                    ostr.WriteByte((byte)'0');
                    ostr.Write(ROTATEFINAL, 0, ROTATEFINAL.Length);
                    break;
                case 180:
                    ostr.Write(ROTATE180, 0, ROTATE180.Length);
                    tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Right));
                    ostr.Write(tmp, 0, tmp.Length);
                    ostr.WriteByte((byte)' ');
                    tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Top));
                    ostr.Write(tmp, 0, tmp.Length);
                    ostr.Write(ROTATEFINAL, 0, ROTATEFINAL.Length);
                    break;
                case 270:
                    ostr.Write(ROTATE270, 0, ROTATE270.Length);
                    ostr.WriteByte((byte)'0');
                    ostr.WriteByte((byte)' ');
                    tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Right));
                    ostr.Write(tmp, 0, tmp.Length);
                    ostr.Write(ROTATEFINAL, 0, ROTATEFINAL.Length);
                    break;
            }
            if (under.Size > 0) {
                ostr.Write(SAVESTATE, 0, SAVESTATE.Length);
                under.InternalBuffer.WriteTo(ostr);
                ostr.Write(RESTORESTATE, 0, RESTORESTATE.Length);
            }
            if (content.Size > 0) {
                ostr.Write(SAVESTATE, 0, SAVESTATE.Length);
                content.InternalBuffer.WriteTo(ostr);
                ostr.Write(RESTORESTATE, 0, RESTORESTATE.Length);
            }
            if (text != null) {
                ostr.Write(SAVESTATE, 0, SAVESTATE.Length);
                text.InternalBuffer.WriteTo(ostr);
                ostr.Write(RESTORESTATE, 0, RESTORESTATE.Length);
            }
            if (secondContent.Size > 0) {
                secondContent.InternalBuffer.WriteTo(ostr);
            }

            if (ostr is ZDeflaterOutputStream)
                ((ZDeflaterOutputStream)ostr).Finish();
            Put(PdfName.LENGTH, new PdfNumber(streamBytes.Length));
            if (compressed)
                Put(PdfName.FILTER, PdfName.FLATEDECODE);
        }
PdfContents