Package com.lowagie.text

Examples of com.lowagie.text.Anchor


   * 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


      // step 3: we open the document
      document.open();
      // step 4: we add a paragraph to the document
      document.add(new Paragraph("Hello World"));
      // we make references
      Anchor pdfRef = new Anchor("see Hello World in PDF.");
      pdfRef.setReference("./HelloWorldPdf.pdf");
      Anchor rtfRef = new Anchor("see Hello World in RTF.");
      rtfRef.setReference("./HelloWorldRtf.rtf");
     
      // we add the references, but only to the HTML page:
     
      pdf.pause();
      rtf.pause();
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

            // step 3: we open the document
            document.open();
           
            // step 4:
            Paragraph paragraph = new Paragraph("Please visit my ");
            Anchor anchor1 = new Anchor("website (external reference)", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255)));
            anchor1.setReference("http://www.lowagie.com/iText/");
            anchor1.setName("top");
            paragraph.add(anchor1);
            paragraph.add(new Chunk(".\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"));
            document.add(paragraph);
            Anchor anchor2 = new Anchor("please jump to a local destination", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255)));
            anchor2.setReference("#top");
            document.add(anchor2);
    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
      System.err.println(ioe.getMessage());
View Full Code Here

            p.add(new Chunk("How do you do?"));
            doc.add(p);
            p.setAlignment(Element.ALIGN_RIGHT);
            doc.add(p);

            Anchor a = new Anchor("http://www.uni-klu.ac.at");
            a.setReference("http://www.uni-klu.ac.at");
            doc.add(a);

            Image img = Image.getInstance("pngnow.png");
            doc.add(new Chunk(img, 0, 0));
            doc.add(new Annotation("Mark", "This works!"));
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.