{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 IV page footer eyebrow, chapter, regional and drawing objects

use in the third to the fifth chapter describes a large number of simple objects can be avoided iText more advanced topics (IX-XII), bear in mind that these restrictions on the function of simple object, a large number of complex functions in the third part.

header footer

HeaderFooter objects can be added for the document header and footer of each page. A header or footer that contains a standard phrase (if needed) and the current page, if you need more complex headers and footers (using the form or the first few pages of a total of a few pages), please read the twelfth chapter.

sample code in 0401, you can see we added a page that contains the footer there is no border.

HeaderFooter footer = new HeaderFooter (new Phrase ( "This is page:"), true);

footer.Border = Rectangle.NO_BORDER;

document.Footer = footer

We also can use the following constructor:

HeaderFooter footer = new HeaderFooter (new Phrase ( "This is page"), new Phrase ("."));

constructor

know you want to add a page and place it between the two phrases, if you just set up a HeaderFooter without any change in borders, header or footer text in a straight line from top to bottom each.

HeaderFooter header = new HeaderFooter (new Phrase ( "This is a header without a page number"), false);

document.Header = header;

chapters and regional

in the eleventh chapter describes how to build a tree's appearance, if you only need a simple chapters and (sub) region, you can use Chapter and Section objects to build a tree object automatically:

Paragraph cTitle = new Paragraph ( "This is chapter 1", chapterFont);

Chapter chapter = new Chapter (cTitle, 1);

Paragraph sTitle = new Paragraph("This is section 1 in chapter 1", sectionFont);

Section section = chapter.addSection (sTitle, 1);

sample code in 0402, we added a series of chapters and sub-regional, you can see a complete tree, tree structure by default, if you want to shut down part of the node, you must use the attribute with the value of BookmarkOpen false, see sample code 0403.

graphics

If you want to add graphics, such as linear, circular, geometric form, you should read the reading of Chapter 10, but if you only need a limited number of functions, you can use the Graphic object

Graphic grx = new Graphic ();

//Add a Rectangle

grx.rectangle (100, 700, 100, 100);

//Add a slash

grx.moveTo (100, 700);

grx.lineTo (200, 800);

//will display graphics

grx.stroke ();

document.Add (grx);

complete sample code, see code 0404, if you want to see all the methods, see PdfContentByte object API.

when you want to add a page border or its current location in the text draw a horizontal line, the graphic object very useful. The following methods with the specified width and spacing (if necessary) and draw a border color.

public void setBorder (float linewidth, float extraSpace);

public void setBorder (float linewidth, float extraSpace, Color color);

Methods

following specified width (if necessary) and draw a horizontal line color, line length is specified between the two edge of the percentage of usable area.

public void setHorizontalLine (float linewidth, float percentage)

public void setHorizontalLine (float linewidth, float percentage, Color color)

sample code 5 from the border there is a 5 pounds, 3 pounds of the border line width, there are two horizontal lines, a black, wide-five pounds, one hundred percent of available space, another for red, linewidth 3 pounds, 80% of available space.

there isArticle InformationsComment Information
Category column

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