' Copyright (c) 2003 UJIHARA Kazuya. All rights reserved. ' ' Redistribution and use in source and binary forms, with or without ' modification, are permitted provided that the following conditions ' are met: ' ' 1. Redistributions of source code must retain the above copyright ' notice, this list of conditions and the following disclaimer. ' ' 2. Redistributions in binary form must reproduce the above copyright ' notice, this list of conditions and the following disclaimer in ' the Documentation and/or other materials provided with the ' distribution. ' ' 3. The end-user Documentation included with the redistribution, ' if any, must include the following acknowledgment: ' "This product includes software developed by ' Kazuya Ujihara ." ' Alternately, this acknowledgment may appear in the software itself, ' if and wherever such third-party acknowledgments normally appear. ' ' THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ' WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ' OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ' DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ' ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ' SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ' LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF ' USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ' ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ' OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ' OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ' SUCH DAMAGE. ' ==================================================================== ' ' This code is free software. It may only be copied or modified ' if you include the following copyright notice: ' ' --> Copyright 2001 by Bruno Lowagie <-- ' ' This code is part of the 'iText Tutorial'. ' You can find the complete tutorial at the following address: ' http:'www.lowagie.com/iText/tutorial/ ' ' This code is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ' ' itext@lowagie.com Option Strict On Imports System Imports com.lowagie.text Imports com.lowagie.text.pdf Imports java.io Public Class Chap0202 Public Shared Sub Main(ByVal args As String()) Console.WriteLine("Chapter 2 example 2: Phrases") ' step 1: creation of a document-object Dim Document As New Document() ' step 2: ' we create a writer that listens to the document ' and directs a PDF-stream to a file PdfWriter.getInstance(Document, New FileOutputStream("Chap0202.pdf")) ' step 3: we open the document Document.open() ' step 4: we add a paragraph to the document Dim phrase0 As New Phrase() Dim phrase1 As New Phrase("(1) this is a phrase\n") ' In this example the leading is passed as a parameter Dim phrase2 As New Phrase(24, "(2) this is a phrase with leading 24. You can only see the difference if the line is long enough. Do you see it? There is more space between this line and the previous one.\n") ' When a Font is passed (explicitely or embedded in a chunk), ' the default leading = 1.5 * size of the font Dim phrase3 As New Phrase("(3) this is a phrase with a red, normal font Courier, size 20. As you can see the leading is automatically changed.\n", FontFactory.getFont(FontFactory.COURIER, 20, Font.NORMAL, New java.awt.Color(255, 0, 0))) Dim phrase4 As New Phrase(New Chunk("(4) this is a phrase\n")) Dim phrase5 As New Phrase(18, New Chunk("(5) this is a phrase in Helvetica, bold, red and size 16 with a given leading of 18 points.\n", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, New java.awt.Color(255, 0, 0)))) ' A Phrase can contains several chunks with different fonts Dim phrase6 As New Phrase("(6)") Dim Chunk As New Chunk(" This is a font: ") phrase6.add(Chunk) phrase6.add(New Chunk("Helvetica", FontFactory.getFont(FontFactory.HELVETICA, 12))) phrase6.add(Chunk) phrase6.add(New Chunk("Times New Roman", FontFactory.getFont(FontFactory.TIMES_ROMAN, 12))) phrase6.add(Chunk) phrase6.add(New Chunk("Courier", FontFactory.getFont(FontFactory.COURIER, 12))) phrase6.add(Chunk) phrase6.add(New Chunk("Symbol", FontFactory.getFont(FontFactory.SYMBOL, 12))) phrase6.add(Chunk) phrase6.add(New Chunk("ZapfDingBats", FontFactory.getFont(FontFactory.ZAPFDINGBATS, 12))) Dim phrase7 As New Phrase("(7) if you don't add a newline yourself, all phrases are glued to eachother!") Document.add(phrase1) Document.add(phrase2) Document.add(phrase3) Document.add(phrase4) Document.add(phrase5) Document.add(phrase6) Document.add(phrase7) ' step 5: we close the document Document.close() End Sub End Class