' 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.
' ====================================================================
' **********************************************************
' Examples of iTextDotNet in VB.NET: Create RTF-Files
' Chapters: 0802
' **********************************************************
' File: CreateRtf.vb
' Author: Klaus Horsten
' Purpose: Create RTF-Examples in VB.NET
' Uses Files (add a reference to):
' iTextdotNET.dll
' JavaRT.dll
' vjslib.dll
' Credits and Copyrights:
' * Original Author and Copyright 2001 - 2003:
' Bruno Lowagie
' See iText Tutorial:
' http://www.lowagie.com/iText/tutorial/
' * Uses iText .NET:
' Copyright 2002 - 2003 Kazuya Ujihara
' **********************************************************
' ====================================================================
'
' 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 RtfWriter = com.lowagie.text.rtf.RtfWriter
Imports java.io
Public Class Chap0802
Public Shared Sub Main(ByVal args As String())
Console.WriteLine("Chapter 8 example 2: RTF")
' step 1: creation of a document-object
Dim doc As New Document
Dim FileOutputStream As FileOutputStream
FileOutputStream = New FileOutputStream("Chap0802.rtf")
RtfWriter.getInstance(doc, FileOutputStream)
doc.open()
doc.add(New Paragraph("Hello World"))
Dim paragraph1 As Paragraph = New Paragraph("(1) this is a Paragraph")
Dim Font As Font
Font = New Font(Font.COURIER, 20, Font.NORMAL)
Dim paragraph3 As New Paragraph("(3) this is a Paragraph with a red, normal font Courier, size 20.", New Font(Font.COURIER, 20, Font.NORMAL, New java.awt.Color(255, 0, 0)))
Dim paragraph4 As Paragraph = New Paragraph(New Chunk("(4) this is a Paragraph"))
Dim paragraph5 As New Paragraph(New Chunk("(5) this is a Paragraph in Helvetica, bold, red and size 16.", New Font(Font.HELVETICA, 16, Font.BOLD, New java.awt.Color(255, 0, 0))))
Dim paragraph6 As Paragraph = New Paragraph("(6)")
Dim chunk As Chunk = New Chunk(" This is a font: ")
paragraph6.add(chunk)
paragraph6.add(New Chunk("Helvetica", New Font(Font.HELVETICA)))
paragraph6.add(chunk)
paragraph6.add(New Chunk("Times New Roman", New Font(Font.TIMES_ROMAN)))
paragraph6.add(chunk)
paragraph6.add(New Chunk("Courier", New Font(Font.COURIER)))
paragraph6.add(chunk)
paragraph6.add(New Chunk("Symbol", New Font(Font.SYMBOL)))
paragraph6.add(chunk)
Dim anchor1 As New Anchor("website (external reference)", New Font(Font.HELVETICA, 12, Font.UNDERLINE, New java.awt.Color(0, 0, 255)))
anchor1.setReference("http://www.ujihara.jp/iTextdotNET/")
doc.add(paragraph1)
doc.add(paragraph3)
doc.add(paragraph4)
doc.add(paragraph5)
doc.add(paragraph6)
doc.add(anchor1)
doc.close()
End Sub
End Class