Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSDictionary.removeItem()


        COSDictionary trailer = doc.getTrailer();
        //sort xref, needed only if object keys not regenerated
        Collections.sort(getXRefEntries());
        COSWriterXRefEntry lastEntry = (COSWriterXRefEntry)getXRefEntries().get( getXRefEntries().size()-1);
        trailer.setInt(COSName.getPDFName("Size"), (int)lastEntry.getKey().getNumber()+1);
        trailer.removeItem( COSName.PREV );
        /**
        COSObject catalog = doc.getCatalog();
        if (catalog != null)
        {
            trailer.setItem(COSName.getPDFName("Root"), catalog);
View Full Code Here


            this.willEncrypt = false;
            // also need to get rid of the "Encrypt" in the trailer so readers
            // don't try to decrypt a document which is not encrypted
            COSDocument cosDoc = doc.getDocument();
            COSDictionary trailer = cosDoc.getTrailer();
            trailer.removeItem(COSName.getPDFName("Encrypt"));
        }
        else
        {
            SecurityHandler securityHandler = document.getSecurityHandler();
            if(securityHandler != null)
View Full Code Here

        COSWriterXRefEntry lastEntry = getXRefEntries().get( getXRefEntries().size()-1);
        trailer.setInt(COSName.SIZE, (int)lastEntry.getKey().getNumber()+1);
        // Only need to stay, if an incremental update will be performed
        if (!incrementalUpdate)
        {
          trailer.removeItem( COSName.PREV );
        }
        if (!doc.isXRefStream())
        {
            trailer.removeItem( COSName.XREF_STM );
        }
View Full Code Here

        {
          trailer.removeItem( COSName.PREV );
        }
        if (!doc.isXRefStream())
        {
            trailer.removeItem( COSName.XREF_STM );
        }
        // Remove a checksum if present
        trailer.removeItem( COSName.DOC_CHECKSUM );
       
        trailer.accept(this);
View Full Code Here

        if (!doc.isXRefStream())
        {
            trailer.removeItem( COSName.XREF_STM );
        }
        // Remove a checksum if present
        trailer.removeItem( COSName.DOC_CHECKSUM );
       
        trailer.accept(this);
    }

    /**
 
View Full Code Here

            COSDictionary trailer = doc.getTrailer();
            trailer.setLong(COSName.PREV, doc.getStartXref());
            if (hybridPrev != -1)
            {
                COSName xrefStm = COSName.XREF_STM;
                trailer.removeItem(xrefStm);
                trailer.setLong(xrefStm, getStartxref());
            }
            addXRefEntry(COSWriterXRefEntry.getNullEntry());
   
            // sort xref, needed only if object keys not regenerated
View Full Code Here

            willEncrypt = false;
            // also need to get rid of the "Encrypt" in the trailer so readers
            // don't try to decrypt a document which is not encrypted
            COSDocument cosDoc = doc.getDocument();
            COSDictionary trailer = cosDoc.getTrailer();
            trailer.removeItem(COSName.ENCRYPT);
        }
        else
        {
            if (document.getEncryption() != null)
            {
View Full Code Here

    @Test
    public void testMissingD() throws Exception
    {
        COSDictionary action = createSubmitAction();
        action.removeItem(COSName.D);
        valid(action, false, PreflightConstants.ERROR_ACTION_MISING_KEY);
    }

    @Test
    public void testInvalidD() throws Exception
View Full Code Here

    @Test
    public void testHideAction_MissingT() throws Exception
    {
        COSDictionary action = createHideAction();
        action.removeItem(COSName.T);
        valid(action, false, PreflightConstants.ERROR_ACTION_MISING_KEY);
    }
}
View Full Code Here

    @Test
    public void testMissngF() throws Exception
    {
        COSDictionary action = createSubmitAction();
        action.removeItem(COSName.F);
        valid(action, false, PreflightConstants.ERROR_ACTION_MISING_KEY);
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.