Package org.apache.fop.area

Examples of org.apache.fop.area.PageViewport


                        + " Stopping early after the first page.");
                break;
            }
            try {
                // Do the rendering: get the image for this page
                PageViewport pv = (PageViewport)pageViewportList.get(i);
                RenderedImage image = (RenderedImage)getPageImage(pv);
   
                // Encode this image
                if (log.isDebugEnabled()) {
                    log.debug("Encoding page " + (i + 1));
View Full Code Here


        if (!resolved && pageIDRef.equals(id) && pages != null) {
            if (log.isDebugEnabled()) {
                log.debug("Resolving pageNumber: " + id);
            }
            resolved = true;
            PageViewport page;
            if (pageType == FIRST) {
                page = (PageViewport)pages.get(0);
            } else {
                page = (PageViewport)pages.get(pages.size() - 1);
            }
            // replace the text
            removeText();
            text = page.getPageNumberString();
            addWord(text, 0);
            // update ipd
            if (font != null) {
                handleIPDVariation(font.getWordWidth(text) - getIPD());
                // set the Font object to null, as we don't need it any more
View Full Code Here

        CTM pageCTM = CTM.getCTMandRelDims(pageSeq.getReferenceOrientation(),
            Constants.EN_LR_TB, referenceRect, reldims);
       
        Page page = new Page(referenceRect, pageNumber, pageNumberString, isBlank);
       
        PageViewport pv = page.getPageViewport();
        org.apache.fop.area.Page pageArea = new org.apache.fop.area.Page();
        pv.setPage(pageArea);

        RegionViewport rv = new RegionViewport(referenceRect);
        rv.setIPD(referenceRect.width);
        rv.setBPD(referenceRect.height);
        rv.setClip(true);
       
        BodyRegion body = new BodyRegion(Constants.FO_REGION_BODY,
                "fop-image-region", rv, 1, 0);
        body.setIPD(imageSize.width);
        body.setBPD(imageSize.height);
        body.setCTM(pageCTM);
        rv.setRegionReference(body);
        pageArea.setRegionViewport(
                Constants.FO_REGION_BODY, rv);
        //Set unique key obtained from the AreaTreeHandler
        pv.setKey(areaTreeHandler.generatePageViewportKey());

        //Also creates first normal flow region
        pv.createSpan(false);
       
        return page;
    }
View Full Code Here

            curPage.getPageViewport().createSpan(false);
            return;
        } else if (breakVal == Constants.EN_COLUMN
                || breakVal <= 0
                || breakVal == Constants.EN_AUTO) {
            PageViewport pv = curPage.getPageViewport();
           
            //Check if previous page was spanned
            boolean forceNewPageWithSpan = false;
            RegionBody rb = (RegionBody)curPage.getSimplePageMaster().getRegion(
                    Constants.FO_REGION_BODY);
            if (breakVal < 0
                    && rb.getColumnCount() > 1
                    && pv.getCurrentSpan().getColumnCount() == 1) {
                forceNewPageWithSpan = true;
            }
           
            if (forceNewPageWithSpan) {
                curPage = pslm.makeNewPage(false, false);
                curPage.getPageViewport().createSpan(true);
            } else if (pv.getCurrentSpan().hasMoreFlows()) {
                pv.getCurrentSpan().moveToNextFlow();
            } else {
                curPage = pslm.makeNewPage(false, false);
            }
            return;
        }
View Full Code Here

     * @param pageNumberStr the page number (as a String)
     * @param blank true if this is a blank page
     */
    public Page(SimplePageMaster spm, int pageNumber, String pageNumberStr, boolean blank) {
        this.spm = spm;
        this.pageViewport = new PageViewport(spm, pageNumber, pageNumberStr, blank);
    }
View Full Code Here

     * @param pageNumberStr the page number (as a String)
     * @param blank true if this is a blank page
     */
    public Page(Rectangle2D viewArea, int pageNumber, String pageNumberStr, boolean blank) {
        this.spm = null;
        this.pageViewport = new PageViewport(viewArea, pageNumber, pageNumberStr, null, blank);
    }
View Full Code Here

    /**
     * if id can be resolved then simply return a word, otherwise
     * return a resolvable area
     */
    private InlineArea getPageNumberCitationInlineArea(LayoutManager parentLM) {
        PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
        TextArea text = null;
        if (page != null) {
            String str = page.getPageNumberString();
            // get page string from parent, build area
            text = new TextArea();
            int width = getStringWidth(str);
            text.addWord(str, 0);
            text.setIPD(width);
View Full Code Here

            getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable)text);
            String str = "MMM"; // reserve three spaces for page number
            int width = getStringWidth(str);
            text.setIPD(width);
        } else {
            PageViewport page = getPSLM().getLastPVWithID(fobj.getRefId());
            String str = page.getPageNumberString();
            // get page string from parent, build area
            text = new TextArea();
            int width = getStringWidth(str);
            text.addWord(str, 0);
            text.setIPD(width);
View Full Code Here

        if (state != null) {
            throw new IllegalStateException("state must be null");
        }
        Graphics2D graphics = (Graphics2D) g;
        try {
            PageViewport viewport = getPageViewport(pageIndex);
            AffineTransform at = graphics.getTransform();
            state = new Java2DGraphicsState(graphics, this.fontInfo, at);

            // reset the current Positions
            currentBPPosition = 0;
            currentIPPosition = 0;

            renderPageAreas(viewport.getPage());
            return PAGE_EXISTS;
        } catch (FOPException e) {
            log.error(e);
            return NO_SUCH_PAGE;
        } finally {
View Full Code Here

    /**
     * if id can be resolved then simply return a word, otherwise
     * return a resolvable area
     */
    private InlineArea getPageNumberCitationInlineArea(LayoutManager parentLM) {
        PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
        TextArea text = null;
        if (page != null) {
            String str = page.getPageNumberString();
            // get page string from parent, build area
            text = new TextArea();
            int width = getStringWidth(str);
            text.addWord(str, 0);
            text.setIPD(width);
View Full Code Here

TOP

Related Classes of org.apache.fop.area.PageViewport

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.