Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSArray


     * user space. When the page is displayed or printed, its contents are to be clipped (cropped)
     * to this rectangle.
     */
    public PDRectangle getCropBox()
    {
        COSArray array = (COSArray) PDPageTree.getInheritableAttribute(page, COSName.CROP_BOX);
        if (array != null)
        {
            return clipToMediaBox(new PDRectangle(array));
        }
        else
View Full Code Here


     * @return The BleedBox attribute.
     */
    public PDRectangle getBleedBox()
    {
        PDRectangle retval;
        COSArray array = (COSArray) page.getDictionaryObject(COSName.BLEED_BOX);
        if (array != null)
        {
            retval = clipToMediaBox(new PDRectangle(array));
        }
        else
View Full Code Here

     * @return The TrimBox attribute.
     */
    public PDRectangle getTrimBox()
    {
        PDRectangle retval;
        COSArray array = (COSArray) page.getDictionaryObject(COSName.TRIM_BOX);
        if (array != null)
        {
            retval = clipToMediaBox(new PDRectangle(array));
        }
        else
View Full Code Here

     * @return The ArtBox attribute.
     */
    public PDRectangle getArtBox()
    {
        PDRectangle retval;
        COSArray array = (COSArray) page.getDictionaryObject(COSName.ART_BOX);
        if (array != null)
        {
            retval = clipToMediaBox(new PDRectangle(array));
        }
        else
View Full Code Here

    // concerning german umlauts see also https://sourceforge.net/forum/message.php?msg_id=4705274
    private DictionaryEncoding encodingFromAFM(FontMetrics metrics) throws IOException
    {
        Type1Encoding encoding = new Type1Encoding(metrics);

        COSArray differences = new COSArray();
        differences.add(COSInteger.ZERO);
        for (int i = 0; i < 256; i++)
        {
            differences.add(COSName.getPDFName(encoding.getName(i)));
        }
        // my AFMPFB-Fonts has no character-codes for german umlauts
        // so that I've to add them here by hand
        differences.set(0337 + 1, COSName.getPDFName("germandbls"));
        differences.set(0344 + 1, COSName.getPDFName("adieresis"));
        differences.set(0366 + 1, COSName.getPDFName("odieresis"));
        differences.set(0374 + 1, COSName.getPDFName("udieresis"));
        differences.set(0304 + 1, COSName.getPDFName("Adieresis"));
        differences.set(0326 + 1, COSName.getPDFName("Odieresis"));
        differences.set(0334 + 1, COSName.getPDFName("Udieresis"));

        return new DictionaryEncoding(COSName.STANDARD_ENCODING, differences);
    }
View Full Code Here

     *
     * @return A list of article threads on this page.
     */
    public List<PDThreadBead> getThreadBeads()
    {
        COSArray beads = (COSArray) page.getDictionaryObject(COSName.B);
        if (beads == null)
        {
            beads = new COSArray();
        }
        List<PDThreadBead> pdObjects = new ArrayList<PDThreadBead>();
        for (int i = 0; i < beads.size(); i++)
        {
            COSDictionary beadDic = (COSDictionary) beads.getObject(i);
            PDThreadBead bead = null;
            // in some cases the bead is null
            if (beadDic != null)
            {
                bead = new PDThreadBead(beadDic);
View Full Code Here

     * @throws IOException If there is an error while creating the annotations.
     */
    public List<PDAnnotation> getAnnotations() throws IOException
    {
        COSArrayList<PDAnnotation> retval;
        COSArray annots = (COSArray) page.getDictionaryObject(COSName.ANNOTS);
        if (annots == null)
        {
            annots = new COSArray();
            page.setItem(COSName.ANNOTS, annots);
            retval = new COSArrayList<PDAnnotation>(new ArrayList<PDAnnotation>(), annots);
        }
        else
        {
            List<PDAnnotation> actuals = new ArrayList<PDAnnotation>();
            for (int i = 0; i < annots.size(); i++)
            {
                COSBase item = annots.getObject(i);
                if (item == null)
                {
                    continue;
                }
                actuals.add(PDAnnotation.createAnnotation(item));
View Full Code Here

    private COSString getDefaultAppearance()
    {
        COSString dap = parent.getDefaultAppearance();
        if (dap == null)
        {
            COSArray kids = (COSArray) parent.getDictionary().getDictionaryObject(COSName.KIDS);
            if (kids != null && kids.size() > 0)
            {
                COSDictionary firstKid = (COSDictionary) kids.getObject(0);
                dap = (COSString) firstKid.getDictionaryObject(COSName.DA);
            }
            if (dap == null)
            {
                dap = (COSString) acroForm.getDictionary().getDictionaryObject(COSName.DA);
View Full Code Here

    private int getQ()
    {
        int q = parent.getQ();
        if (parent.getDictionary().getDictionaryObject(COSName.Q) == null)
        {
            COSArray kids = (COSArray) parent.getDictionary().getDictionaryObject(COSName.KIDS);
            if (kids != null && kids.size() > 0)
            {
                COSDictionary firstKid = (COSDictionary) kids.getObject(0);
                COSNumber qNum = (COSNumber) firstKid.getDictionaryObject(COSName.Q);
                if (qNum != null)
                {
                    q = qNum.intValue();
                }
View Full Code Here

            retval = new COSArrayList<Object>(map, dp, stream,
                    COSName.DECODE_PARMS);
        }
        else if (dp instanceof COSArray)
        {
            COSArray array = (COSArray) dp;
            List<Object> actuals = new ArrayList<Object>();
            for (int i = 0; i < array.size(); i++)
            {
                actuals.add(COSDictionaryMap
                        .convertBasicTypesToMap((COSDictionary) array
                                .getObject(i)));
            }
            retval = new COSArrayList<Object>(actuals, array);
        }
View Full Code Here

TOP

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

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.