Package com.lowagie.text

Examples of com.lowagie.text.Anchor


            Paragraph p = new Paragraph();
            p.setLeading(0, 2);

            p.add(new Chunk("Servi Entrega\n", new Font(Font.HELVETICA, 16, Font.BOLDITALIC, Color.blue)));
            p.add(new Chunk("Reporte Gerencial\n\n", new Font(Font.HELVETICA, 12, Font.NORMAL)));
            Anchor link = new Anchor(projectURL, new Font(Font.HELVETICA, 11, Font.NORMAL));
            link.setReference(projectURL);
            p.add(link);

            p.add(new Chunk("\n\n" + parameters.get(PARAM_COMPUTATION_TIME) + "\n", new Font(Font.HELVETICA, 11, Font.NORMAL)));

            table.getDefaultCell().setBackgroundColor(Color.WHITE);
View Full Code Here


                currentfont.pop();
                return;
            }
            case Element.ANCHOR:
            {
                Anchor anchor = (Anchor) element;
                styleAttributes = new Properties();
                if (anchor.hasLeading()) styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, anchor.getLeading() + "pt");
               
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.ANCHOR);
                if (anchor.getName() != null) {
                    write(HtmlTags.NAME, anchor.getName());
                }
                if (anchor.getReference() != null) {
                    write(HtmlTags.REFERENCE, anchor.getReference());
                }
                writeMarkupAttributes(markup);
                write(anchor.getFont(), styleAttributes);
                os.write(GT);
                currentfont.push(anchor.getFont());
                // contents
                for (Iterator i = anchor.iterator(); i.hasNext(); ) {
                    write((Element) i.next(), indent + 1);
                }
                // end tag
                addTabs(indent);
                writeEnd(HtmlTags.ANCHOR);
View Full Code Here

    if ("GoTo".equals(action)) {
      if (bookmark.get("Page") != null) {
        String page = (String)bookmark.get("Page");
        StringTokenizer tokens = new StringTokenizer(page);
        String token = tokens.nextToken();
        Anchor anchor = new Anchor(" page" + token);
        anchor.setReference(pdf + "#page=" + token);
        title.add(anchor);
      }
    }
    else if ("URI".equals(action)) {
      String url = (String)bookmark.get("URI");
      Anchor anchor = new Anchor(" Goto URL");
      anchor.setReference(url);
      title.add(anchor);
    }
    else if ("GoToR".equals(action)) {
      String remote = (String)bookmark.get("File");
      Anchor anchor = new Anchor(" goto " + remote);
      if (bookmark.get("Named") != null) {
        String named = (String)bookmark.get("Named");
        remote = remote + "#nameddest=" + named;
      }
      else if (bookmark.get("Page") != null) {
        String page = (String)bookmark.get("Page");
        StringTokenizer tokens = new StringTokenizer(page);
        String token = tokens.nextToken();
        anchor.add(new Chunk(" page " + token));
        remote = remote + "#page=" + token;
      }
      anchor.setReference(remote);
      title.add(anchor);
    }
    if (section == null) {
      s = new Chapter(title, 0);
    }
View Full Code Here

   * Creates an Anchor object based on a list of properties.
   * @param attributes
   * @return an Anchor
   */
  public static Anchor getAnchor(Properties attributes) {
    Anchor anchor = new Anchor(getPhrase(attributes));
    String value;
    value = attributes.getProperty(ElementTags.NAME);
    if (value != null) {
      anchor.setName(value);
    }
    value = (String) attributes.remove(ElementTags.REFERENCE);
    if (value != null) {
      anchor.setReference(value);
    }
    return anchor;
  }
View Full Code Here

                    }
                    break;
                }
                case Element.ANCHOR: {
                  leadingCount++;
                    Anchor anchor = (Anchor) element;
                    String url = anchor.getReference();
                    leading = anchor.getLeading();
                    if (url != null) {
                        anchorAction = new PdfAction(url);
                    }
                    // we process the element
                    element.process(this);
View Full Code Here

   * Creates an Anchor object based on a list of properties.
   * @param attributes
   * @return an Anchor
   */
  public static Anchor getAnchor(Properties attributes) {
    Anchor anchor = new Anchor(getPhrase(attributes));
    String value;
        value = attributes.getProperty(ElementTags.NAME);
        if (value != null) {
            anchor.setName(value);
        }
        value = (String)attributes.remove(ElementTags.REFERENCE);
        if (value != null) {
            anchor.setReference(value);
        }
    return anchor;
  }
View Full Code Here

                currentfont.pop();
                return;
            }
            case Element.ANCHOR:
            {
                Anchor anchor = (Anchor) element;
                styleAttributes = new Properties();
                if (anchor.hasLeading()) styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, anchor.getLeading() + "pt");
               
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.ANCHOR);
                if (anchor.getName() != null) {
                    write(HtmlTags.NAME, anchor.getName());
                }
                if (anchor.getReference() != null) {
                    write(HtmlTags.REFERENCE, anchor.getReference());
                }
                writeMarkupAttributes(markup);
                write(anchor.getFont(), styleAttributes);
                os.write(GT);
                currentfont.push(anchor.getFont());
                // contents
                for (Iterator i = anchor.iterator(); i.hasNext(); ) {
                    write((Element) i.next(), indent + 1);
                }
                // end tag
                addTabs(indent);
                writeEnd(HtmlTags.ANCHOR);
View Full Code Here

                        newPage();
                    }
                    break;
                }
                case Element.ANCHOR: {
                    Anchor anchor = (Anchor) element;
                    String url = anchor.getReference();
                    leading = anchor.getLeading();
                    if (url != null) {
                        anchorAction = new PdfAction(url);
                    }
                    // we process the element
                    element.process(this);
View Full Code Here

                                   "The second one will be called when the HTML page is being unloaded,\n" +
                                   "for example when you go to another page.\n");
              document.add(phrase1);

            // add a HTML link <A HREF="...">
              Anchor anchor = new Anchor("Click here to execute the third JavaScript function.");
              anchor.setReference("JavaScript:sayHi()");
              document.add(anchor);

    } catch (Exception de) {
      de.printStackTrace();
    }
View Full Code Here

                    }
                    break;
                }
                case Element.ANCHOR: {
                  leadingCount++;
                    Anchor anchor = (Anchor) element;
                    String url = anchor.getReference();
                    leading = anchor.getLeading();
                    if (url != null) {
                        anchorAction = new PdfAction(url);
                    }
                    // we process the element
                    element.process(this);
View Full Code Here

TOP

Related Classes of com.lowagie.text.Anchor

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.