Hi,
I wrote the following code:
import java.lang.*;
import java.io.*;
import java.io.File;
import java.util.Vector;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.Image;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.ColumnText;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class Text {
public static void main(String[] args) {
// step 1: creation of a document-object
Document document = new Document();
try {
document.setPageSize(PageSize.A4);
PdfWriter writer = PdfWriter.getInstance(document,new
FileOutputStream("f:\\text.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
BaseFont bf = BaseFont.createFont
("c:\\WINDOWS\\Fonts\\tahoma.ttf", BaseFont.IDENTITY_H, true);
Font ft8 = new Font(bf, 8);
ColumnText.showTextAligned(cb, PdfContentByte.ALIGN_LEFT,
new Phrase("Ez itt 8 es betűtípussal van írva. Se nem nagyobb, se nem
kisebb.", ft8), 30, 100, 0);
cb.stroke();
}
catch(DocumentException de) {
System.err.println(de.getMessage());
}
catch(IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5: we close the document
document.close();
}
}
the output is: Ez itt 8 es betűtípussal van írva. Se nem nagyobb, se
nem kisebb.
I made a doc file too. The font type is tahoma, and the font size is 8 as
by the pdf.
When I print the two documents, the size of the text is different. (pdf
78 mm, doc 81 mm)
Somebody knows why?
thanks,
Gabor
_______________________________________________________________________
[freemail] extra 1GB-os postafiókkal, Önnek már van? http://freemail.hu
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions