Package org.apache.fop.area

Examples of org.apache.fop.area.PageViewport


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


            if (log.isDebugEnabled()) {
                log.debug("Resolving pageNumber: " + id);
            }
            resolved = true;
            int pageIndex = pageType ? 0 : pages.size() - 1;
            PageViewport page = pages.get(pageIndex);
            // replace the text
            removeText();
            text = page.getPageNumberString();
            addWord(text, 0, getBidiLevel());
            // 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

    private void renderBookmarkItem(BookmarkData bm) {
        atts.clear();
        addAttribute("title", bm.getBookmarkTitle());
        addAttribute("show-children", String.valueOf(bm.showChildItems()));
        PageViewport pv = bm.getPageViewport();
        String pvKey = pv == null ? null : pv.getKey();
        addAttribute("internal-link",
                     InternalLink.makeXMLAttribute(pvKey, bm.getIDRef()));
        startElement("bookmark", atts);
        for (int i = 0; i < bm.getCount(); i++) {
            renderBookmarkItem(bm.getSubData(i));
View Full Code Here

    protected void renderDestination(DestinationData destination) {
        if (destination.getWhenToProcess() == OffDocumentItem.END_OF_DOC) {
            endPageSequence();
        }
        atts.clear();
        PageViewport pv = destination.getPageViewport();
        String pvKey = pv == null ? null : pv.getKey();
        addAttribute("internal-link",
                InternalLink.makeXMLAttribute(pvKey, destination.getIDRef()));
        startElement("destination", atts);
        endElement("destination");
    }
View Full Code Here

        }
        String targetID = dd.getIDRef();
        if (targetID == null || targetID.length() == 0) {
            throw new IllegalArgumentException("DestinationData must contain a ID reference");
        }
        PageViewport pv = dd.getPageViewport();
        if (pv != null) {
            GoToXYAction action = getGoToActionForID(targetID, pv.getPageIndex());
            NamedDestination namedDestination = new NamedDestination(targetID, action);
            this.deferredDestinations.add(namedDestination);
        } else {
            //Warning already issued by AreaTreeHandler (debug level is sufficient)
            log.debug("Unresolved destination item received: " + dd.getIDRef());
View Full Code Here

        String targetID = bookmarkItem.getIDRef();
        if (targetID == null || targetID.length() == 0) {
            throw new IllegalArgumentException("DestinationData must contain a ID reference");
        }
        GoToXYAction action = null;
        PageViewport pv = bookmarkItem.getPageViewport();

        if (pv != null) {
            action = getGoToActionForID(targetID, pv.getPageIndex());
        } else {
            //Warning already issued by AreaTreeHandler (debug level is sufficient)
            log.debug("Bookmark with IDRef \"" + targetID + "\" has a null PageViewport.");
        }
View Full Code Here

     * @param viewHeight height of the view
     * @return the requested scale factor
     * @throws FOPException in case of an error while fetching the PageViewport
     */
    public double getScaleToFit(double viewWidth, double viewHeight) throws FOPException {
        PageViewport pageViewport = renderer.getPageViewport(currentPage);
        Rectangle2D pageSize = pageViewport.getViewArea();
        float screenResolution = Toolkit.getDefaultToolkit().getScreenResolution();
        float screenFactor = screenResolution / UnitConv.IN2PT;
        double widthScale = viewWidth / (pageSize.getWidth() / 1000f) / screenFactor;
        double heightScale = viewHeight / (pageSize.getHeight() / 1000f) / screenFactor;
        return Math.min(displayMode == CONT_FACING ? widthScale / 2 : widthScale, heightScale);
View Full Code Here

     *
     * TODO: [GA] May need to run bidi algorithm and script processor
     * on resolved page number.
     */
    private InlineArea getPageNumberCitationInlineArea() {
        PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
        TextArea text = null;
        int level = getBidiLevel();
        if (page != null) {
            String str = page.getPageNumberString();
            // get page string from parent, build area
            text = new TextArea();
            int width = getStringWidth(str);    // TODO: [GA] !I18N!
            text.setBidiLevel(level);
            text.addWord(str, 0, level);
View Full Code Here

            int width = getStringWidth(str);
            text.setBidiLevel(level);
            text.setIPD(width);
            resolved = false;
        } 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.setBidiLevel(level);
            text.addWord(str, 0, level);
View Full Code Here

            while (page < 0 && doc && seq > 1) {
                seq--;
                page = areaTreeModel.getPageCount(seq) - 1;
            }
            while (page >= 0) {
                PageViewport pv = areaTreeModel.getPage(seq, page);
                mark = (Marker)pv.getMarker(name, Constants.EN_LEWP);
                if (mark != null) {
                    break;
                }
                page--;
                if (page < 0 && doc && seq > 1) {
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.