|Published (Last):||8 July 2004|
|PDF File Size:||16.78 Mb|
|ePub File Size:||2.97 Mb|
|Price:||Free* [*Free Regsitration Required]|
In this chapter, we will see how to set color and font to text in a PDF document using the iText library. While instantiating this class, you need to pass a PdfDocument object as a parameter to its constructor. To add a paragraph to the document, you need to instantiate the Paragraph class and add this object to the document using the add method.
You can set color and font to the text using the methods setFontColor and setFont respectively. Following are the steps to set color and font to text in a pdf document. This class belongs to the package com.
The constructor of this class accepts a string, representing the path of the file where the PDF is to be created. Instantiate the PdfWriter class by passing a string value representing the path where you need to create a PDF to its constructor, as shown below. To instantiate this class in writing mode , you need to pass an object of the class PdfWriter to its constructor. Instantiate the PdfDocument class by passing the PdfWriter object to its constructor, as shown below. Step 3: Creating the Document class The Document class of the package com.
One of the constructors of this class accepts an object of the class PdfDocument. Instantiate the Document class by passing the object of the class PdfDocument created in the previous steps, as shown below. Pass the PdfFont object as a parameter, as shown below. It creates a PDF document with the name fonts. FontConstants; import com. Color; import com.
PdfFontFactory; import com. PdfFont; import com. PdfDocument; import com. PdfWriter; import com. Document; import com. Paragraph; import com. Text added to pdf..
Subscribe to RSS
Milkis ExceptionConverter ; import com. PdfWriter ; import itet. There are also varying numbers of parameters passed, which ilustrates some of the different overloads available. SAXParser ; import javax. Skip to main content. Would you like to answer one of these unanswered questions instead?
iText - Setting Font
iTextSharp - Working with Fonts