Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSString


                }
                newKArray.addAll(srcKArray);
            }
            kDictLevel0.setItem(COSName.K, newKArray);
            kDictLevel0.setItem(COSName.P, destStructTree);
            kDictLevel0.setItem(COSName.S, new COSString(STRUCTURETYPE_DOCUMENT));
            destStructTree.setK(kDictLevel0);
        }
    }
View Full Code Here


        raFile.seek(0);

        // Test COSString
        out = new RandomAccessFileOutputStream(raFile);
        out.setExpectedLength(new COSString("24"));
        out.write(buffer);
        assertEquals(48, out.getPosition());
        assertEquals(16, out.getLength());
        assertEquals(16, out.getLengthWritten());
        assertEquals(new COSString("24"), out.getExpectedLength());
        assertEquals(64, raFile.length());
        assertEquals(64, raFile.getPosition());
        out.close();

        raFile.seek(0);
View Full Code Here

    {
        if (!inTextMode)
        {
            throw new IOException("Error: must call beginText() before drawString");
        }
        COSString string = new COSString(text);
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        string.writePDF(buffer);
        appendRawCommands(buffer.toByteArray());
        appendRawCommands(SPACE);
        appendRawCommands(SHOW_TEXT);
    }
View Full Code Here

                    "Hexa string shall contain even number of non white space char at offset "+pdfSource.getOffset()));
        }

        // reset the offset to parse the COSString
        pdfSource.seek(offset);
        COSString result = super.parseCOSString();

        if (result.getString().length() > MAX_STRING_LENGTH)
        {
            addValidationError(new ValidationError(ERROR_SYNTAX_HEXA_STRING_TOO_LONG, "Hexa string is too long at offset "+pdfSource.getOffset()));
        }
        return result;
    }
View Full Code Here

            for (int i = 0; i < fields.size() && retval == null; i++)
            {
                COSDictionary element = (COSDictionary) fields.getObject(i);
                if( element != null )
                {
                    COSString fieldName =
                        (COSString)element.getDictionaryObject( COSName.T );
                    if( fieldName.getString().equals( name ) ||
                        fieldName.getString().equals( nameSubSection[0] ) )
                    {
                        PDFieldTreeNode root = PDFieldTreeNode.createField( this, element, null );

                        if( nameSubSection.length > 1 )
                        {
View Full Code Here

     */
    public void setDefaultAppearance(String daValue)
    {
        if (daValue != null)
        {
            defaultAppearance = new COSString(daValue);
            getDictionary().setItem(COSName.DA, defaultAppearance);
        }
        else
        {
            defaultAppearance = null;
View Full Code Here

        if (value != null)
        {
            if (value instanceof String)
            {
                String stringValue = (String)value;
                COSString fieldValue = new COSString(stringValue);
                getDictionary().setItem( COSName.V, fieldValue );
            }
            // TODO stream instead of string
       
        else
View Full Code Here

                new ByteArrayInputStream(signBuffer));

        // sign the bytes
        SignatureInterface signatureInterface = doc.getSignatureInterface();
        byte[] sign = signatureInterface.sign(signStream);
        String signature = new COSString(sign).getHexString();
        // substract 2 bytes because of the enclosing "<>"
        if (signature.length() > signatureLength - 2)
        {
            throw new IOException("Can't write signature, not enough space");
        }
View Full Code Here

public class ShowText extends OperatorProcessor
{
    @Override
    public void process(Operator operator, List<COSBase> arguments) throws IOException
    {
        COSString string = (COSString)arguments.get( 0 );
        context.showTextString(string.getBytes());
    }
View Full Code Here

            {
                COSNull.NULL.accept( this );
            }
            else if( current instanceof COSString )
            {
                COSString copy = new COSString();
                copy.append(((COSString)current).getBytes());
                copy.accept(this);
            }
            else
            {
                current.accept(this);
            }
View Full Code Here

TOP

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

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.