Hello community,
there is a phantastic library, call iText, to create PDF documents. You find it here:
http://www.lowagie.com/iText/. It is a free Java library to generate PDF files on the fly. Now a small snippet how to use it with Jabaco after you add the JAR file to your classpath:
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
'-Variables---------------------------------------------------------
Dim Doc As com#lowagie#text#Document
Dim Out As java#io#FileOutputStream
Dim Head As com#lowagie#text#HeaderFooter
Dim hPhrase As com#lowagie#text#Phrase
Dim Foot As com#lowagie#text#HeaderFooter
Dim fPhrase As com#lowagie#text#Phrase
Dim Par As com#lowagie#text#Paragraph
'-Create Document---------------------------------------------------
Set Doc = New Document(com#lowagie#text#PageSize.A4, 50, 50, 50, 50)
Set Out = New FileOutputStream("C:\Dummy\JabacoPDFDemo.pdf")
com#lowagie#text#pdf#PdfWriter.getInstance Doc, Out
'-Define Header-----------------------------------------------------
Set hPhrase = New Phrase("Jabaco - PDF-Demo")
Set Head = New HeaderFooter(hPhrase, False)
Head.setBorder(com#lowagie#text#Rectangle.BOTTOM)
Doc.setHeader(Head)
'-Define Footer-----------------------------------------------------
Set fPhrase = New Phrase("Seite ")
Set Foot = New HeaderFooter(fPhrase, True)
Foot.setAlignment(Element.ALIGN_CENTER)
Foot.setBorder(com#lowagie#text#Rectangle.TOP)
Doc.setFooter(Foot)
Doc.open()
'-Write Paragraphs in Document--------------------------------------
Set Par = New Paragraph("Dies ist ein Test")
Doc.add(Par)
Doc.newPage()
Doc.add(Par)
Doc.close()
|
It is a great library with a lot of possibilities and a very good online documentation with a lot of examples, look here:
http://www.1t3xt.com/docs/book.php.
Cheers
Stefan