【JSP开源代码栏目提醒】:网学会员为广大网友收集整理了,EX13-8.jsp,希望对大家有所帮助!
<%@page import="java.io.*,
com.lowagie.text.*,
com.lowagie.text.pdf.*"
%><%
response.setContentType( "application/pdf" );
Document document = new Document(PageSize.A4.rotate());
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter.getInstance( document, buffer );
document.open();
document.add(new Paragraph("To create a document in landscape format, just make the height smaller than the width. For instance by rotating the PageSize Rectangle: PageSize.A4.rotate()"));
document.setPageSize(PageSize.A4);
document.newPage();
document.add(new Paragraph("This is portrait again"));
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] ); }
%>
上一篇:
EX13-7.jsp
下一篇:
什么是“双核心期刊”