public Box getBoxById(String id) { return sharedContext.getBoxById(id); } }
public Box getBoxById(String id) { return sharedContext.getBoxById(id); } }
private void writeBookmark(RenderingContext c, Box root, PdfOutline parent, Bookmark bookmark) { String href = bookmark.getHRef(); PdfDestination target = null; if (href.length() > 0 && href.charAt(0) == '#') { Box box = _sharedContext.getBoxById(href.substring(1)); if (box != null) { PageBox page = root.getLayer().getPage(c, getPageRefY(box)); int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP); distanceFromTop += box.getAbsY() - page.getTop(); target = new PdfDestination(PdfDestination.XYZ, 0, normalizeY(distanceFromTop / _dotsPerPoint), 0); target.addPage(_writer.getPageReference(_startPageNo + page.getPageNo()+1)); } } if (target == null) { target = _defaultDestination; } PdfOutline outline = new PdfOutline(parent, target, bookmark.getName()); writeBookmarks(c, root, outline, bookmark.getChildren()); }
private void writeBookmark(RenderingContext c, Box root, PdfOutline parent, Bookmark bookmark) { String href = bookmark.getHRef(); PdfDestination target = null; if (href.length() > 0 && href.charAt(0) == '#') { Box box = _sharedContext.getBoxById(href.substring(1)); if (box != null) { PageBox page = root.getLayer().getPage(c, getPageRefY(box)); int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP); distanceFromTop += box.getAbsY() - page.getTop(); target = new PdfDestination(PdfDestination.XYZ, 0, normalizeY(distanceFromTop / _dotsPerPoint), 0); target.addPage(_writer.getPageReference(_startPageNo + page.getPageNo()+1)); } } if (target == null) { target = _defaultDestination; } PdfOutline outline = new PdfOutline(parent, target, bookmark.getName()); writeBookmarks(c, root, outline, bookmark.getChildren()); }
private void writeBookmark(RenderingContext c, Box root, PdfOutline parent, Bookmark bookmark) { String href = bookmark.getHRef(); PdfDestination target = null; Box box = bookmark.getBox(); if (href.length() > 0 && href.charAt(0) == '#') { box = _sharedContext.getBoxById(href.substring(1)); } if (box != null) { PageBox page = root.getLayer().getPage(c, getPageRefY(box)); int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP); distanceFromTop += box.getAbsY() - page.getTop(); target = new PdfDestination(PdfDestination.XYZ, 0, normalizeY(distanceFromTop / _dotsPerPoint), 0); target.addPage(_writer.getPageReference(_startPageNo + page.getPageNo() + 1)); } if (target == null) { target = _defaultDestination; } PdfOutline outline = new PdfOutline(parent, target, bookmark.getName()); writeBookmarks(c, root, outline, bookmark.getChildren()); }
private void writeBookmark(RenderingContext c, Box root, PdfOutline parent, Bookmark bookmark) { String href = bookmark.getHRef(); PdfDestination target = null; Box box = bookmark.getBox(); if (href.length() > 0 && href.charAt(0) == '#') { box = _sharedContext.getBoxById(href.substring(1)); } if (box != null) { PageBox page = root.getLayer().getPage(c, getPageRefY(box)); int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP); distanceFromTop += box.getAbsY() - page.getTop(); target = new PdfDestination(PdfDestination.XYZ, 0, normalizeY(distanceFromTop / _dotsPerPoint), 0); target.addPage(_writer.getPageReference(_startPageNo + page.getPageNo() + 1)); } if (target == null) { target = _defaultDestination; } PdfOutline outline = new PdfOutline(parent, target, bookmark.getName()); writeBookmarks(c, root, outline, bookmark.getChildren()); }
private void writeBookmark(RenderingContext c, Box root, PdfOutline parent, Bookmark bookmark) { String href = bookmark.getHRef(); PdfDestination target = null; Box box = bookmark.getBox(); if (href.length() > 0 && href.charAt(0) == '#') { box = _sharedContext.getBoxById(href.substring(1)); } if (box != null) { PageBox page = root.getLayer().getPage(c, getPageRefY(box)); int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP); distanceFromTop += box.getAbsY() - page.getTop(); target = new PdfDestination(PdfDestination.XYZ, 0, normalizeY(distanceFromTop / _dotsPerPoint), 0); target.addPage(_writer.getPageReference(_startPageNo + page.getPageNo() + 1)); } if (target == null) { target = _defaultDestination; } PdfOutline outline = new PdfOutline(parent, target, bookmark.getName()); writeBookmarks(c, root, outline, bookmark.getChildren()); }
/** * Sets the new current document, where the new document is located * relative, e.g using a relative URL. * * @param filename * The new document to load */ protected void setDocumentRelative(String filename) { String url = _sharedContext.getUac().resolveURI(filename); if (isAnchorInCurrentDocument(filename)) { String id = getAnchorId(filename); Box box = _sharedContext.getBoxById(id); if (box != null) { Point pt; if (box.getStyle().isInline()) { pt = new Point(0 /* box.getAbsX() */, box.getAbsY()); } else { RectPropertySet margin = box.getMargin(_layout_context); pt = new Point(0 /* box.getAbsX() + (int) margin.left() */, box.getAbsY() + (int) margin.top()); } setOrigin(pt); return; } } Document dom = loadDocument(url); setDocument(dom, url); }
if (uri.length() > 1 && uri.charAt(0) == '#') { String anchor = uri.substring(1); Box target = _sharedContext.getBoxById(anchor); if (target != null) { PdfDestination dest = createDestination(c, target);
if (uri.length() > 1 && uri.charAt(0) == '#') { String anchor = uri.substring(1); Box target = _sharedContext.getBoxById(anchor); if (target != null) { PdfDestination dest = createDestination(c, target);
/** * Sets the new current document, where the new document * is located relative, e.g using a relative URL. * * @param filename The new document to load */ protected void setDocumentRelative(String filename) { String url = getSharedContext().getUac().resolveURI(filename); if (isAnchorInCurrentDocument(filename)) { String id = getAnchorId(filename); Box box = getSharedContext().getBoxById(id); if (box != null) { Point pt; if (box.getStyle().isInline()) { pt = new Point(box.getAbsX(), box.getAbsY()); } else { RectPropertySet margin = box.getMargin(getLayoutContext()); pt = new Point( box.getAbsX() + (int)margin.left(), box.getAbsY() + (int)margin.top()); } scrollTo(pt); return; } } Document dom = loadDocument(url); setDocument(dom, url); }
/** * Sets the new current document, where the new document * is located relative, e.g using a relative URL. * * @param filename The new document to load */ protected void setDocumentRelative(String filename) { String url = getSharedContext().getUac().resolveURI(filename); if (isAnchorInCurrentDocument(filename)) { String id = getAnchorId(filename); Box box = getSharedContext().getBoxById(id); if (box != null) { Point pt; if (box.getStyle().isInline()) { pt = new Point(box.getAbsX(), box.getAbsY()); } else { RectPropertySet margin = box.getMargin(getLayoutContext()); pt = new Point( box.getAbsX() + (int)margin.left(), box.getAbsY() + (int)margin.top()); } scrollTo(pt); return; } } Document dom = loadDocument(url); setDocument(dom, url); }
if (uri.length() > 1 && uri.charAt(0) == '#') { String anchor = uri.substring(1); Box target = _sharedContext.getBoxById(anchor); if (target != null) { PdfDestination dest = createDestination(c, target);
if (uri.length() > 1 && uri.charAt(0) == '#') { String anchor = uri.substring(1); Box target = _sharedContext.getBoxById(anchor); if (target != null) { PdfDestination dest = createDestination(c, target);
if (uri.length() > 1 && uri.charAt(0) == '#') { String anchor = uri.substring(1); Box target = _sharedContext.getBoxById(anchor); if (target != null) { PdfDestination dest = createDestination(c, target);