Package org.apache.pdfbox.pdmodel.common

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


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


     *
     * @return The MediaBox at this level in the hierarchy.
     */
    public PDRectangle findMediaBox()
    {
        PDRectangle retval = getMediaBox();
        if( retval == null && getParent() != null )
        {
            retval = getParent().findMediaBox();
        }
        return retval;
View Full Code Here

     *
     * @return The CropBox at this level in the hierarchy.
     */
    public PDRectangle getCropBox()
    {
        PDRectangle retval = null;
        COSArray array = (COSArray)page.getDictionaryObject( COSName.CROP_BOX);
        if( array != null )
        {
            retval = new PDRectangle( array );
        }
        return retval;
    }
View Full Code Here

     *
     * @return The CropBox at this level in the hierarchy.
     */
    public PDRectangle findCropBox()
    {
        PDRectangle retval = getCropBox();
        PDPageNode parent = getParent();
        if( retval == null && parent != null )
        {
            retval = findParentCropBox( parent );
        }
View Full Code Here

     *
     * @param node The node
     */
    private PDRectangle findParentCropBox( PDPageNode node )
    {
        PDRectangle rect = node.getCropBox();
        PDPageNode parent = node.getParent();
        if( rect == null && parent != null )
        {
            rect = findParentCropBox( parent );
        }
View Full Code Here

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

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

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

     *
     * @throws IOException If there is an error drawing to the image.
     */
    public BufferedImage convertToImage(int imageType, int resolution) throws IOException
    {
        PDRectangle mBox = findMediaBox();
        float widthPt = mBox.getWidth();
        float heightPt = mBox.getHeight();
        float scaling = resolution / (float)DEFAULT_USER_SPACE_UNIT_DPI;
        int widthPx = Math.round(widthPt * scaling);
        int heightPx = Math.round(heightPt * scaling);
        //TODO The following reduces accuracy. It should really be a Dimension2D.Float.
        Dimension pageDimension = new Dimension( (int)widthPt, (int)heightPt );
View Full Code Here

    {
        int retval = Printable.PAGE_EXISTS;
        try
        {
            PageDrawer drawer = new PageDrawer();
            PDRectangle cropBox = findCropBox();
            drawer.drawPage( graphics, this, cropBox.createDimension() );
        }
        catch( IOException io )
        {
            throw new PrinterIOException( io );
        }
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.