有一些pdfnet库,等,不知道对你有没有帮助。如果直接保存pdf的话。这个没有接触到。jfreereport也在学习啊。
解决方案 »
- HibernateDaoSupport中delete方法无效,单元测试有效
- 利用JNA,java调用c的dll动态连库异常。。。
- 严重: ORA-02289: 序列不存在。急!!!在线等...
- WEB 应用 跨 Tomcat 和 weblogic 的 问题 , 请牛牛们出个 注意撒 ~oo~, 俺先谢谢了
- 下午软件设计师试题
- 同一servlet中的init方法在多个用户请求时是不是只有第一个用户执行这个方法,其他用户直接执行service方法??
- 我的jsp文件为何为何只能在Tomcat4\webapps\examples下用?
- 在一个函数中new一个对象,然后在另一个函数中修改该对象,可以吗?
- 在EJB中如何声明所需的资源
- petstore怎么安装,怎么用啊?
- 在weblogic8.1下用xmlbeans读取xml文件出错???在线等!!!感激!!!
- 模糊搜索中的问题!
而JasperReport可以生成很多种文件格式的报表,其中包括pdf格式,它使用
生成pdf格式报表的引擎是iText,所以JFreeReport跟iText没有可比性
另外一种就是直接使用JasperReport的API生成报表,然后输出成PDF.这些都主要针对
报表而言的,如果只是一般的文档,那就可以直接使用Itext啦
import java.io.IOException;import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
public class HelloWorld { /**
* Generates a PDF file with the text 'Hello World'
*
* @param args no arguments needed here
*/
public static void main(String[] args) { System.out.println("Hello World"); // step 1: creation of a document-object
Document document = new Document();
try {
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.getInstance(document,
new FileOutputStream("HelloWorld.pdf")); // step 3: we open the document
document.open();
// step 4: we add a paragraph to the document
document.add(new Paragraph("Hello World"));
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
} // step 5: we close the document
document.close();
}
}