Package org.apache.pdfbox.pdmodel.common

Examples of org.apache.pdfbox.pdmodel.common.PDRectangle


    {
        ensureLoaded();

        if( this.fontBBox == null )
        {
            this.fontBBox = new PDRectangle(this.fontMetric.getFontBBox());
        }

        return this.fontBBox;
    }
View Full Code Here


        if (desc != null)
        {
            // the following values are all more or less accurate at least all are average
            // values. Maybe we'll find another way to get those value for every single glyph
            // in the future if needed
            PDRectangle fontBBox = desc.getFontBoundingBox();
            float retval = 0;
            if (fontBBox != null)
            {
                retval = fontBBox.getHeight() / 2;
            }
            if (retval == 0)
            {
                retval = desc.getCapHeight();
            }
View Full Code Here

     * @return The fonts bounding box.
     */
    public PDRectangle getFontBBox()
    {
        COSArray rect = (COSArray) dict.getDictionaryObject(COSName.FONT_BBOX);
        PDRectangle retval = null;
        if(rect != null)
        {
            retval = new PDRectangle(rect);
        }
        return retval;
    }
View Full Code Here

    }

    @Override
    public BoundingBox getBoundingBox()
    {
        PDRectangle rect = getFontBBox();
        return new BoundingBox(rect.getLowerLeftX(), rect.getLowerLeftY(),
                               rect.getWidth(), rect.getHeight());
    }
View Full Code Here

            throw new IllegalArgumentException("First page of pdf is 1, not " + page);
        }


        PDPage firstPage = document.getPage(page - 1);
        PDRectangle mediaBox = firstPage.getMediaBox();
        pageHeight(mediaBox.getHeight());
        pageWidth = mediaBox.getWidth();

        float x = this.pageWidth;
        float y = 0;
        pageWidth = this.pageWidth + y;
        float tPercent = (100 * y / (x + y));
View Full Code Here

            {
                values[i] = Float.parseFloat( rectValues[i] );
            }
            COSArray array = new COSArray();
            array.setFloatArray( values );
            setRectangle( new PDRectangle( array ) );
        }

        setName( element.getAttribute( "title" ) );
        setCreationDate( DateConverter.toCalendar( element.getAttribute( "creationdate" ) ) );
        String opac = element.getAttribute( "opacity" );
View Full Code Here

     *
     * @return The annotation rectangle.
     */
    public PDRectangle getRectangle()
    {
        PDRectangle retval = null;
        COSArray rectArray = (COSArray)annot.getDictionaryObject( COSName.RECT );
        if( rectArray != null )
        {
            retval = new PDRectangle( rectArray );
        }
        return retval;
    }
View Full Code Here

                for (int i = 0; i < pageArticles.size() && foundArticleDivisionIndex == -1; i++)
                {
                    PDThreadBead bead = pageArticles.get(i);
                    if (bead != null)
                    {
                        PDRectangle rect = bead.getRectangle();
                        if (rect.contains(x, y))
                        {
                            foundArticleDivisionIndex = i * 2 + 1;
                        }
                        else if ((x < rect.getLowerLeftX() ||
                                y < rect.getUpperRightY()) &&
                                notFoundButFirstLeftAndAboveArticleDivisionIndex == -1)
                        {
                            notFoundButFirstLeftAndAboveArticleDivisionIndex = i * 2;
                        }
                        else if (x < rect.getLowerLeftX() &&
                                notFoundButFirstLeftArticleDivisionIndex == -1)
                        {
                            notFoundButFirstLeftArticleDivisionIndex = i * 2;
                        }
                        else if (y < rect.getUpperRightY() &&
                                notFoundButFirstAboveArticleDivisionIndex == -1)
                        {
                            notFoundButFirstAboveArticleDivisionIndex = i * 2;
                        }
                    }
View Full Code Here

        PDFontDescriptor fd = new PDFontDescriptor();
        fd.setFontName(metrics.getFontName());
        fd.setFontFamily(metrics.getFamilyName());
        fd.setNonSymbolic(!isSymbolic);
        fd.setSymbolic(isSymbolic);
        fd.setFontBoundingBox(new PDRectangle(metrics.getFontBBox()));
        fd.setItalicAngle(metrics.getItalicAngle());
        fd.setAscent(metrics.getAscender());
        fd.setDescent(metrics.getDescender());
        fd.setCapHeight(metrics.getCapHeight());
        fd.setXHeight(metrics.getXHeight());
View Full Code Here

        if (mediaBox == null)
        {
            COSArray array = (COSArray) PDPageTree.getInheritableAttribute(page, COSName.MEDIA_BOX);
            if (array != null)
            {
                mediaBox = new PDRectangle(array);
            }
        }
        return mediaBox;
    }
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.common.PDRectangle

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.