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

CalculateStreamSize() публичный Метод

public CalculateStreamSize ( int n ) : int
n int
Результат int
        public int CalculateStreamSize(int n)
        {
            if (revision == AES_128 || revision == AES_256)
            return (n & 0x7ffffff0) + 32;
            else
            return n;
        }

Usage Example

Пример #1
0
        public override void ToPdf(PdfWriter writer, Stream os)
        {
            byte[]        b      = PdfReader.GetStreamBytesRaw(this);
            PdfEncryption crypto = null;

            if (writer != null)
            {
                crypto = writer.Encryption;
            }
            PdfObject objLen = Get(PdfName.LENGTH);
            int       nn     = b.Length;

            if (crypto != null)
            {
                nn = crypto.CalculateStreamSize(nn);
            }
            Put(PdfName.LENGTH, new PdfNumber(nn));
            SuperToPdf(writer, os);
            Put(PdfName.LENGTH, objLen);
            os.Write(STARTSTREAM, 0, STARTSTREAM.Length);
            if (length > 0)
            {
                if (crypto != null && !crypto.IsEmbeddedFilesOnly())
                {
                    b = crypto.EncryptByteArray(b);
                }
                os.Write(b, 0, b.Length);
            }
            os.Write(ENDSTREAM, 0, ENDSTREAM.Length);
        }
All Usage Examples Of iTextSharp.text.pdf.PdfEncryption::CalculateStreamSize