如何使用JSP在eclipse 3.3中创建pdf?

时间:2014-09-17 10:22:51

标签: jsp

<% 
@ page import = "java.io. *, java.awt.Color, com.lowagie.text .*, com.lowagie.text.pdf .*"
%>
<%
response.setContentType ( "application / pdf");
Document document = new Document ();
ByteArra`enter code here`yOutputStream buffer = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance (document, buffer);
document.open ();
document.add (new Paragraph ( "Hello World"));
document.close ();
DataOutput output = new DataOutputStream (response.getOutputStream ());
byte [] bytes = buffer.toByteArray ();
response.setContentLength (bytes.length);
for(int i=0; i<bytes.length; i++)
{
output.writeByte (bytes [i]);
}
%>
 

它不起作用并且因为Enumidentifier需要完成EnumHeaderName而给出错误。 这段代码是否正确? 我现在该怎么办?

0 个答案:

没有答案