关于上传jsp文件的问题,请高手赐教。 是这样的,项目要求将当前已打开的JSP页面通过该页面上的一个按钮保存成PDF格式的文件,并且保存到服务器上,请问各位应该怎么实现啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接通过JSP页面生成<%@ page import="java.io.*,java.awt.Color,com.lowagie.text.*,com.lowagie.text.pdf.*"%><% response.setContentType( "application/pdf" ); Document document = new Document(); ByteArrayOutputStream 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] ); }%> 需要引入的包是ITEXT一个开源项目,用来生成PDF,原理就是服务器的response作为文件流用ITEXT写入PDF 保存成pdf格式不是难事,关键是怎样保存到服务器上。 已经工作的进 weblogic9中出现的标签问题 java 工程师招聘 smartupload问题???? 急急。。。。。。 jswdk的一个例子有点不懂[猜数字] 循环往表中插入数据,如何进行错误处理??? 菜鸟问题段落格式,送分 这段代码到底问题出在哪儿? tomcat 最大支持多少会话??可以再+分 全国哪里美女多啊? 关于COOKIE hinernate 存储图片的类型
<%@
page import="java.io.*,java.awt.Color,com.lowagie.text.*,com.lowagie.text.pdf.*"%>
<%
response.setContentType( "application/pdf" );
Document document = new Document();
ByteArrayOutputStream 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] );
}
%>
需要引入的包是ITEXT一个开源项目,用来生成PDF,原理就是服务器的response作为文件流用ITEXT写入PDF