Please note:
The PDF generated by this example program will only work with Adobe Reader v7.0 or Foxit Reader v2.0 or higher versions. It also requires the Asian Font Packs from Adobe or Foxit Software respectively.
PDF pdf = new PDF(); |
|
Font f1 = new Font(
pdf,
"AdobeMingStd-Light",
CodePage.UNICODE);
|
|
Font f2 = new Font(
pdf,
"AdobeSongStd-Light",
CodePage.UNICODE);
|
|
Font f3 = new Font(
pdf,
"KozMinProVI-Regular",
CodePage.UNICODE);
|
|
Font f4 = new Font(
pdf,
"AdobeMyungjoStd-Medium",
CodePage.UNICODE);
|
|
// Please note:
// All font and image objects must be created before the first page.
Page page = new Page(pdf, Letter.PORTRAIT);
double x_pos = 100.0;
double y_pos = 20.0;
StreamReader reader = new StreamReader("data/happy-new-year.txt");
TextLine text = new TextLine(f1);
String line = null;
while ((line = reader.ReadLine()) != null) {
if (line.IndexOf("Simplified") != -1) {
text.SetFont(f2);
} else if (line.IndexOf("Japanese") != -1) {
text.SetFont(f3);
} else if (line.IndexOf("Korean") != -1) {
text.SetFont(f4);
}
text.SetText(line);
text.SetPosition(x_pos, y_pos += 24);
text.DrawOn(page);
}
reader.Close();
pdf.Wrap();
pdf.Save("Example_04.pdf");
|
|
| Example_04.cs | Example_04.pdf |
© 2007 Innovatics Inc.




