⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdf.jsp

📁 java编程java编程java编程java编程java编程java编程java编程
💻 JSP
字号:
<%@page import="java.io.*,			 com.lowagie.text.*,			 com.lowagie.text.pdf.*"errorPage="error.jsp"%><%//// Template JSP file for iText// by Tal Liron//response.setContentType( "application/pdf" );// step 1: creation of a document-objectDocument document = new Document();// step 2:// we create a writer that listens to the document// and directs a PDF-stream to a temporary bufferByteArrayOutputStream buffer = new ByteArrayOutputStream();PdfWriter.getInstance( document, buffer );// step 3: we open the documentdocument.open();// step 4: we add a paragraph to the documentdocument.add(new Paragraph("Hello World"));// step 5: we close the documentdocument.close();// step 6: we output the writer as bytes to the response outputDataOutput 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] ); }%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -