How to implement getDirectContent() itextsharp

橙三吉。 提交于 2019-12-12 18:27:07

问题


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();

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.


回答1:


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;

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



来源:https://stackoverflow.com/questions/16932904/how-to-implement-getdirectcontent-itextsharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!