如何实现getDirectContent()iTextSharp的 [英] How to implement getDirectContent() itextsharp

查看:1278
本文介绍了如何实现getDirectContent()iTextSharp的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在生成PDF文件。我的问题是,我想打印我addressTable成绝对位置

Currently I am working Generating Pdf file. My problem is that I want to print my addressTable into absolute position

PdfWriter writer = PdfWriter.GetInstance(doc,stream)
PdfContentByte cb = writer.getDirectContent();
ColumnText ct = new ColumnText(cb);
Phrase myText = new Phrase("TEST paragraph\nNewline");
ct.SetSimpleColumn(myText, 34, 750, 580, 317, 15, Element.ALIGN_LEFT);
ct.Go();

这是我的code,但getDirectContent()给我的错误。所以,请任何机构帮助我如何打印我的地址表为固定的位置。

This is my code but getDirectContent() give me error. So please any body help me that how to print my address table into fixed position.

推荐答案

这很容易。转到我的书的例子 C#端口。看看在code样品在第3章你会发现用线,如例子:

That's easy. Go to the C# port of the examples of my book. Take a look at the code samples in Chapter 3. You'll find examples with lines such as:

PdfContentByte over = writer.DirectContent;

这是Java版本和C#版本之间的细微区别之一。

This is one of the minor differences between the Java version and the C# version.

这篇关于如何实现getDirectContent()iTextSharp的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆