Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSStream


        return false;
    }

    protected void checkStreamLength(PreflightContext context, COSObject cObj) throws ValidationException
    {
        COSStream streamObj = (COSStream) cObj.getObject();
        int length = streamObj.getInt(COSName.LENGTH);
        InputStream ra = null;
        try
        {
            ra = context.getSource().getInputStream();
            Long offset = context.getDocument().getDocument().getXrefTable().get(new COSObjectKey(cObj));
View Full Code Here


            // the size is the highest object number+1. we add one more
            // for the xref stream object we are going to write
            pdfxRefStream.setSize(getNumber() + 2);

            setStartxref(getStandardOutput().getPos());
            COSStream stream2 = pdfxRefStream.getStream();
            doWriteObject(stream2);
        }

        if (!doc.isXRefStream() || hybridPrev != -1)
        {
View Full Code Here

    /**
     * Create a fresh XRef stream like for a fresh file or an incremental update.
     */
    public PDFXRefStream()
    {
        this.stream = new COSStream(new COSDictionary(), new RandomAccessBuffer());
        streamData = new TreeMap<Integer, Object>();
        objectNumbers = new TreeSet<Integer>();
    }
View Full Code Here

            }
            COSDictionary res = resources.getCOSDictionary();

            if( contents instanceof COSStream )
            {
                COSStream stream = (COSStream) contents;
                Map objectNameMap = new TreeMap();
                stream = makeUniqObjectNames(objectNameMap, stream);

                layoutPages.add(new LayoutPage(stream, res, objectNameMap));
            }
View Full Code Here

            baos.write(b);
        }

        COSDictionary streamDict = new COSDictionary();
        streamDict.setInt(COSName.LENGTH, baos.size());
        COSStream output = pdfDocument.getDocument().createCOSStream(streamDict);
        output.setFilters(stream.getFilters());
        OutputStream os = output.createUnfilteredStream();
        baos.writeTo(os);
        os.close();

        return output;
    }
View Full Code Here

            PDPage page = (PDPage)pageIter.next();
            COSDictionary pageDictionary = page.getCOSDictionary();
            COSBase contents = pageDictionary.getDictionaryObject( COSName.CONTENTS );
            if( contents instanceof COSStream )
            {
                COSStream contentsStream = (COSStream)contents;
                // System.err.println("stream");

                COSArray array = new COSArray();

                array.add(contentsStream);
View Full Code Here

                if( pb instanceof COSDictionary )
                {
                    pb = parseCOSStream( (COSDictionary)pb, getDocument().getScratchFile() );

                    // test for XRef type
                    final COSStream strmObj = (COSStream) pb;
                    final COSName objectType = (COSName)strmObj.getItem( COSName.TYPE );
                    if( objectType != null && objectType.equals( COSName.XREF ) )
                    {
                        // XRef stream
                        parseXrefStream( strmObj, currentObjByteOffset );
                    }
View Full Code Here

    @Test
    public void testIsStream()
    {
        try
        {
            COSObject co = new COSObject(new COSStream(null));
            co.setGenerationNumber(COSInteger.ZERO);
            co.setObjectNumber(new COSInteger(10));

            assertFalse(COSUtils.isStream(co, new IOCOSDocument()));
View Full Code Here

     * {@link #checkStreamKeyWord()} and {@link #checkEndstreamKeyWord()}
     */
    protected COSStream parseCOSStream(COSDictionary dic, RandomAccess file) throws IOException
    {
        checkStreamKeyWord();
        COSStream result = super.parseCOSStream(dic, file);
        checkEndstreamKeyWord();
        return result;
    }
View Full Code Here

                if (endObjectKey.equals("stream"))
                {
                    pdfSource.seek(endObjectOffset);
                    if (pb instanceof COSDictionary)
                    {
                        COSStream stream = parseCOSStream((COSDictionary) pb, getDocument().getScratchFile());
                        if (securityHandler != null)
                        {
                            try
                            {
                                securityHandler.decryptStream(stream, objNr, objGenNr);
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.cos.COSStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.