{oapdf_gg}
Office software is closely linked to the PDF,the PDF is also must have to control!      Set home Page  Add to Favorites  
You are here:Home > PDF Application > PDF Development
PDF Development
Using C# language the whole PDF document Strategy Guide Graphic
Finishing by: Date:2009-04-17 20:59:48 Popularity: Tags:

Chapter III anchor , lists and notes

anchor

we all know that in the HTML hypertext links, when we click on certain words, you can jump to other pages online. Also in the PDF of this function can be achieved. In fact, the entire section of Chapter XI on the PDF link in the introduction, but this is iText more advanced applications, this chapter we deal with simple iText.

If you want to add a document to external links (such as the use of URL links to other documents on the WEB), you can simply use the Anchor object, it is derived from Phrase object, use the same method. There are only two additional methods of the definition of two additional variables:setName and setReference.

External links

example:

Anchor anchor = new Anchor ( "website", FontFactory.getFont (FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color (0, 0, 255 )));

anchor.Reference = "http://itextsharp.sourceforge.net";

anchor.Name = "website";

If you want to add the internal link, select the link you need a different name, as you phase in the HTML to use the same name as the anchor. To that end, you need to add a "#."

internal link

example:

Anchor anchor1 = new Anchor ( "This is an internal link ");

anchor1.Name = "link1";

Anchor anchor2 = new Anchor ( "Click here to jump to the internal link ");

anchor.Reference = "# link1";

link these two examples, see sample code 0301.

list

through Class List and ListItem, you can add a list of the PDF document, for the list you can choose whether or not to sort.

to sort a list of examples:

List list = new List (true, 20);

list.Add (new ListItem ( "First line "));

list.Add (new ListItem ( "The second line is longer to see what happens once the end of the line is reached. Will it start on a new line ?"));

list.Add (new ListItem ( "Third line "));

results are as follows:

  1. First line
  2. The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?
  3. Third line

not sort the following example:

List overview = new List (false, 10);

overview.Add (new ListItem ( "This is an item "));

overview.Add ( "This is another item ");

results are as follows:

  • This is an item
  • This is another item

you can change the list of symbols setListSymbol methods:

//use the string as a list of symbols

list1.ListSymbol = "*";

//use Chunk as a list of symbols (including "•" character)

list2.ListSymbol = new Chunk ( "\ u2022", FontFactory.getFont (FontFactory.HELVETICA, 20 ));

//use image as a list of symbols

list3.ListSymbol = new Chunk (Image.getInstance ( "myBullet.gif"), 0, 0);

can also use the method set setIndentationLeft and setIndentationRight indent, indented list of symbols set in the constructor. More examples please see the sample code 0302.

there isArticle InformationsComment Information
Category column

Site Help | Site Map | Feedback |
OAPDF.COM Copyright 2009 V1.1