public void initializePage(PdfContentByte currentPage, float height) { _currentPage = currentPage; _pageHeight = height; _currentPage.saveState(); _transform = new AffineTransform(); _transform.scale(1.0d / _dotsPerPoint, 1.0d / _dotsPerPoint); _stroke = transformStroke(STROKE_ONE); _originalStroke = _stroke; _oldStroke = _stroke; setStrokeDiff(_stroke, null); if (_defaultDestination == null) { _defaultDestination = new PdfDestination(PdfDestination.FITH, height); _defaultDestination.addPage(_writer.getPageReference(1)); } _linkTargetAreas = new HashSet(); }
/** * Constructs a new <CODE>PdfDestination</CODE>. * <P> * If <VAR>type</VAR> equals <VAR>FITB</VAR>, the bounding box of a page * will fit the window of the Reader. Otherwise the type will be set to * <VAR>FIT</VAR> so that the entire page will fit to the window. * * @param type The destination type */ public PdfDestination(int type) { super(); if (type == FITB) { add(PdfName.FITB); } else { add(PdfName.FIT); } }
/** Adds the indirect reference of the destination page. * * @param page an indirect reference * @return true if the page reference was added */ public boolean addPage(PdfIndirectReference page) { if (!status) { addFirst(page); status = true; return true; } return false; } }
/** * The local destination to where a local goto with the same * name will jump to. * @param name the name of this local destination * @param destination the <CODE>PdfDestination</CODE> with the jump coordinates * @return <CODE>true</CODE> if the local destination was added, * <CODE>false</CODE> if a local destination with the same name * already existed */ boolean localDestination(String name, PdfDestination destination) { Object obj[] = (Object[])localDestinations.get(name); if (obj == null) obj = new Object[3]; if (obj[2] != null) return false; obj[2] = destination; localDestinations.put(name, obj); if (!destination.hasPage()) destination.addPage(writer.getCurrentPage()); return true; }
Bookmark(Bookmark parent, int x, int top, String title) { this(parent, new PdfDestination(PdfDestination.XYZ, x, top, 0), title); }
/** * Set the page of the <CODE>PdfDestination</CODE>-object. * * @param pageReference indirect reference to the page * @return <CODE>true</CODE> if this page was set as the <CODE>PdfDestination</CODE>-page. */ public boolean setDestinationPage(PdfIndirectReference pageReference) { if (destination == null) { return false; } return destination.addPage(pageReference); }
/** Helper for the constructors. * @param parent the parent outline * @param title the title for this outline * @param open <CODE>true</CODE> if the children are visible */ void initOutline(PdfOutline parent, String title, boolean open) { this.open = open; this.parent = parent; writer = parent.writer; put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE)); parent.addKid(this); if (destination != null && !destination.hasPage()) // bugfix Finn Bock setDestinationPage(writer.getCurrentPage()); }
/** * Adds named destinations in bulk. * Valid keys and values of the map can be found in the map * that is created by SimpleNamedDestination. * @param map a map with strings as keys for the names, * and structured strings as values for the destinations * @param page_offset number of pages that has to be added to * the page numbers in the destinations (useful if you * use this method in combination with PdfCopy). * @since iText 5.0 */ public void addNamedDestinations(Map<String, String> map, int page_offset) { Map.Entry<String, String> entry; int page; String dest; PdfDestination destination; for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext(); ) { entry = i.next(); dest = entry.getValue(); page = Integer.parseInt(dest.substring(0, dest.indexOf(" "))); destination = new PdfDestination(dest.substring(dest.indexOf(" ") + 1)); addNamedDestination(entry.getKey(), page + page_offset, destination); } }
/** * Set the page of the <CODE>PdfDestination</CODE>-object. * * @param pageReference indirect reference to the page * @return <CODE>true</CODE> if this page was set as the <CODE>PdfDestination</CODE>-page. */ public boolean setDestinationPage(PdfIndirectReference pageReference) { if (destination == null) { return false; } return destination.addPage(pageReference); }
/** * The local destination to where a local goto with the same * name will jump to. * @param name the name of this local destination * @param destination the <CODE>PdfDestination</CODE> with the jump coordinates * @return <CODE>true</CODE> if the local destination was added, * <CODE>false</CODE> if a local destination with the same name * already existed */ boolean localDestination(String name, PdfDestination destination) { Object[] obj = localDestinations.get(name); if (obj == null) obj = new Object[3]; if (obj[2] != null) return false; obj[2] = destination; localDestinations.put(name, obj); if (!destination.hasPage()) destination.addPage(writer.getCurrentPage()); return true; }
/** Helper for the constructors. * @param parent the parent outline * @param title the title for this outline * @param open <CODE>true</CODE> if the children are visible */ void initOutline(PdfOutline parent, String title, boolean open) { this.open = open; this.parent = parent; writer = parent.writer; put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE)); parent.addKid(this); if (destination != null && !destination.hasPage()) // bugfix Finn Bock setDestinationPage(writer.getCurrentPage()); }
public void initializePage(PdfContentByte currentPage, float height) { _currentPage = currentPage; _pageHeight = height; _currentPage.saveState(); _transform = new AffineTransform(); _transform.scale(1.0d / _dotsPerPoint, 1.0d / _dotsPerPoint); _stroke = transformStroke(STROKE_ONE); _originalStroke = _stroke; _oldStroke = _stroke; setStrokeDiff(_stroke, null); if (_defaultDestination == null) { _defaultDestination = new PdfDestination(PdfDestination.FITH, height); _defaultDestination.addPage(_writer.getPageReference(1)); } _linkTargetAreas = new HashSet(); }
/** * Adds named destinations in bulk. * Valid keys and values of the map can be found in the map * that is created by SimpleNamedDestination. * @param map a map with strings as keys for the names, * and structured strings as values for the destinations * @param page_offset number of pages that has to be added to * the page numbers in the destinations (useful if you * use this method in combination with PdfCopy). * @since iText 5.0 */ public void addNamedDestinations(Map map, int page_offset) { Map.Entry entry; int page; String dest; PdfDestination destination; for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) { entry = (Map.Entry)i.next(); dest = (String)entry.getValue(); page = Integer.parseInt(dest.substring(0, dest.indexOf(" "))); destination = new PdfDestination(dest.substring(dest.indexOf(" ") + 1)); addNamedDestination((String)entry.getKey(), page + page_offset, destination); } }
/** * Set the page of the <CODE>PdfDestination</CODE>-object. * * @param pageReference indirect reference to the page * @return <CODE>true</CODE> if this page was set as the <CODE>PdfDestination</CODE>-page. */ public boolean setDestinationPage(PdfIndirectReference pageReference) { if (destination == null) { return false; } return destination.addPage(pageReference); }
/** * Constructs a new <CODE>PdfDestination</CODE>. * <P> * If <VAR>type</VAR> equals <VAR>FITB</VAR>, the bounding box of a page * will fit the window of the Reader. Otherwise the type will be set to * <VAR>FIT</VAR> so that the entire page will fit to the window. * * @param type The destination type */ public PdfDestination(int type) { super(); if (type == FITB) { add(PdfName.FITB); } else { add(PdfName.FIT); } }
/** Helper for the constructors. * @param parent the parent outline * @param title the title for this outline * @param open <CODE>true</CODE> if the children are visible */ void initOutline(PdfOutline parent, String title, boolean open) { this.open = open; this.parent = parent; writer = parent.writer; put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE)); parent.addKid(this); if (destination != null && !destination.hasPage()) // bugfix Finn Bock setDestinationPage(writer.getCurrentPage()); }
/** Adds the indirect reference of the destination page. * * @param page an indirect reference * @return true if the page reference was added */ public boolean addPage(PdfIndirectReference page) { if (!status) { addFirst(page); status = true; return true; } return false; } }
public void initializePage(PdfContentByte currentPage, float height) { _currentPage = currentPage; _pageHeight = height; _currentPage.saveState(); _transform = new AffineTransform(); _transform.scale(1.0d / _dotsPerPoint, 1.0d / _dotsPerPoint); _stroke = transformStroke(STROKE_ONE); _originalStroke = _stroke; _oldStroke = _stroke; setStrokeDiff(_stroke, null); if (_defaultDestination == null) { _defaultDestination = new PdfDestination(PdfDestination.FITH, height); _defaultDestination.addPage(_writer.getPageReference(1)); } _linkTargetAreas = new HashSet(); }
final Integer location = locationByTitle.get(pageTitle); final PdfAction newAction = PdfAction.gotoLocalPage(location, new PdfDestination(0), stamper.getWriter());
/** * The local destination to where a local goto with the same * name will jump to. * @param name the name of this local destination * @param destination the <CODE>PdfDestination</CODE> with the jump coordinates * @return <CODE>true</CODE> if the local destination was added, * <CODE>false</CODE> if a local destination with the same name * already existed */ boolean localDestination(String name, PdfDestination destination) { Object obj[] = (Object[])localDestinations.get(name); if (obj == null) obj = new Object[3]; if (obj[2] != null) return false; obj[2] = destination; localDestinations.put(name, obj); destination.addPage(writer.getCurrentPage()); return true; }