I'm a Chinese web application developer. You can call me Lee.
In a web application, I need to creat PDF file by online designing(from HTML 
code to PDF file). And the text 
 and images on the pages should have absolute position(reference: 
 http://itextsharp.sourceforge.net/tutorial/ch10.html). These texts include 
Chinese characters, but I don't know 
 how to set their font style as bold or italic.
Thank you!
  
 My codes:
  
 Document doc = new Document(new iTextSharp.text.Rectangle(564, 351));    
PdfWriter writer= PdfWriter.GetInstance(doc, new 
FileStream(HttpContext.Current.Server.MapPath("1.pdf"), 
 FileMode.Create));    
doc.Open();    
PdfContentByte cb = writer.DirectContent;    
cb.BeginText();    
BaseFont bfont = BaseFont.CreateFont(@"c:\windows\fonts\SIMHEI.TTF", 
BaseFont.IDENTITY_H, 
 BaseFont.NOT_EMBEDDED);//Chinese font Heiti    
cb.SetFontAndSize(bfont, 18);    
cb.SetCharacterSpacing(1);    
cb.SetRGBColorFill(66, 00, 00);   
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "在位置100,70处开始显示文本", 100, 
70,0);//Show Chinese character 
 by absolute position   
cb.EndText();    
doc.Close();
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to