Hi chidu, 2009/4/17 chidu <[email protected]>: > > I am using spring's AbstractPdfView for my pdf views. I want a document in > landscape A4. here is the code is used. No matter whatever size i give it > only outputs one size. Please help me. > > > > protected void buildPdfDocument(Map model, Document document, PdfWriter > pdfWriter, > HttpServletRequest request, HttpServletResponse > response) throws > Exception { > > response.addHeader("Content-Disposition", "attachment; > filename=report0011.pdf"); > > document.setPageSize(PageSize.A4.rotate()); > document.add(new Paragraph("Hello",new Font(Font.BOLD))); > document.close(); > > }
You must use document.setPageSize() BEFORE document.open() if you want to change the properties of the first page. Otherwise, these properties changes will apply only on the 2nd page and further. HTH, alexis ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
