如何在iTextSharp中旋转文本?

时间:2011-11-30 10:04:47

标签: c# text itextsharp rotation

我在网上搜索过但看起来并不那么容易,我怎么能旋转我的文字?

Document doc = new Document(new iTextSharp.text.Rectangle(600, 800), 0, 0, 0, 0);
PdfWriter.GetInstance(doc, new FileStream(Directory.GetCurrentDirectory() + "/genpdf.pdf", FileMode.Create));

doc.Open();

iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(file);
Chunk c1 = new Chunk("~Comment~"); //rotate 270°

doc.Add(image);
doc.Add(text);

doc.Close();

1 个答案:

答案 0 :(得分:2)

答案在Rotate text awnser

作者是PdfWriter类型,你可以像:

using (stream = new FileStream(temp_filename, FileMode.Create))
{
    iTextSharp.text.Document document = new iTextSharp.text.Document();
    PdfWriter writer = PdfWriter.GetInstance(document, stream);