A chunk is the smallest significant part that can be added to a document. A chunk is a string with Font information. Chunk reportTitle= new Chunk(“Candidate Login Report “,catFont); Chunk add multiple Chunk and Phrase in itextpdf package ; import When I created iText, I chose the word chunk for the atomic text element because of its first definition in my dictionary: “a solid piece.” A phrase, on the other hand.
|Published (Last):||17 August 2005|
|PDF File Size:||17.50 Mb|
|ePub File Size:||4.22 Mb|
|Price:||Free* [*Free Regsitration Required]|
If you take a close look at figure 2.
This accepts a string, with “Left”, “Center”, “Justify”, and “Right” being itrxt values. Chunk All Implemented Interfaces: Positive values rise the text, negative values lower the text.
Java IText: Chunk
One row, two columns, the left one containing reportTitle left aligned, and the right one containing divisionTitle and right aligned. Note that all child elements won’t also be tagged.
The Phrase is the next container in the hierarchy. Note that separator chunks can’t be used in combination with tab chunks!
You tell iText where to find the font programs for Times New Roman times. You can set the leading or font as part of initiating a new phrase, as well as pass it a string or chunk to set its content through the phrase’s various itexxt constructors.
There must be a local destination matching the name. All other layout parameters should be ietxt in the object to which this chunk of text is added. That explicitly tells the compiler that the value is to be treated as a float, and prevents the sort of mistake I experienced happening again.
The document properties reveal that two fonts were used: Add the Maven Dependecy to your project: The extra parameters of the method define extra space expressed in user units to the left, bottom, right, and top of the Chunk. You ask iText to embed the characters BaseFont. This is no longer the case; most viewers replace these fonts.
Really, all they should be used for is. This example is rather unusual: Every extra line in the same Paragraph will be indented a quarter of an inch. The negative indentation of 18 pt for the first line will be subtracted from the left indentation, causing the first line of each paragraph to start at the left margin.
As with the Label, you need to be careful how you use Chunks. Other properties of the Chunk, such as the background color, the text rise—used to simulate subscript and superscript—and the underline values—used to underline text or strike a line through it—are defined as attributes.
Java IText: Chunk
But an even better solution would be to use a Paragraph object instead of a Phrase. Finallylisting 2. One of the main reasons why people prefer PDF over any other document format is because PDF, as the name tells us, is a portable document format. You might also like Sign up using Facebook. A font defines glyphs for a particular character set. The setBackground method draws a colored chukn behind xhunk text contained in the Chunk.
Why do both viewers still list Helvetica?
We were very lucky that the names were legible.