Esempio n. 1
0
        protected void readDocObj()
        {
            ArrayList streams = new ArrayList();

            xrefObj = new PdfObject[xref.Length];
            for (int k = 1; k < xrefObj.Length; ++k)
            {
                int pos = xref[k];
                if (pos <= 0)
                {
                    continue;
                }
                tokens.seek(pos);
                tokens.nextValidToken();
                if (tokens.TokenType != PRTokeniser.TK_NUMBER)
                {
                    tokens.throwError("Invalid object number.");
                }
                int objNum = tokens.IntValue;
                tokens.nextValidToken();
                if (tokens.TokenType != PRTokeniser.TK_NUMBER)
                {
                    tokens.throwError("Invalid generation number.");
                }
                int objGen = tokens.IntValue;
                tokens.nextValidToken();
                if (!tokens.StringValue.Equals("obj"))
                {
                    tokens.throwError("Token 'obj' expected.");
                }
                PdfObject obj = readPRObject();
                xrefObj[k] = obj;
                if (obj.Type == PdfObject.STREAM)
                {
                    streams.Add(obj);
                }
            }
            for (int k = 0; k < streams.Count; ++k)
            {
                PRStream  stream = (PRStream)streams[k];
                PdfObject length = getPdfObject(stream.get(PdfName.LENGTH));
                stream.Length = ((PdfNumber)length).IntValue;
            }
        }