Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: generating pdf throgh itextrenderer throwing index out of bound exception

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Thanked 0 Times in 0 Posts

    Default generating pdf throgh itextrenderer throwing index out of bound exception

    [CODE][CODE][CODE][QUOTE]	in our web application we are generate pdf using itextrenderer but i got index out of bound exception,following is the code,igot this error in renderer.layout()
    	HttpServletResponse response = (HttpServletResponse) swfRequestContext.getExternalContext().getNativeResponse();
    		Document doc = null;
    			try {
    				byte[] byteArray = mimeContent.getEncodedData();
    				ByteArrayInputStream bis = new ByteArrayInputStream(byteArray);
    				ObjectInputStream out = new ObjectInputStream(bis);
    				try {
    					doc = (Document) out.readObject();
    				} catch (ClassNotFoundException e) {
    					// TODO Auto-generated catch block
    					System.out.println("Exceptions in Document");
    				ITextRenderer renderer = new ITextRenderer();
    				renderer.setDocument(doc, null);
    				//System.out.println("Rendered Documnent::"+renderer.);
    				OutputStream os = response.getOutputStream(); //new FileOutputStream("trial.pdf");
    				response.setHeader("Content-Disposition", "inline; filename=\"ATK_Plans.pdf\"");
    	           response.setHeader("Cache-Control", "private");
    	            response.setDateHeader("max-age", 3600);   
    	            response.setHeader("Pragma", "No-cache");   
    				try {
    				catch (com.lowagie.text.DocumentException e) {
    					// TODO Auto-generated catch block
        enter code here
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    	at java.util.ArrayList.rangeCheck(ArrayList.java:604)
    	at java.util.ArrayList.get(ArrayList.java:382)
    	at org.xhtmlrenderer.newtable.TableSectionBox.cellAt(TableSectionBox.java:102)
    	at org.xhtmlrenderer.newtable.TableRowBox.calcRowHeight(TableRowBox.java:346)
    	at org.xhtmlrenderer.newtable.TableRowBox.calcLayoutHeight(TableRowBox.java:312)
    	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:829)
    	at org.xhtmlrenderer.newtable.TableRowBox.layout(TableRowBox.java:88)
    	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
        enter code here
    	at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    	at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    	at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    	at org.xhtmlrenderer.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:136)
    	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    	at org.xhtmlrenderer.newtable.TableSectionBox.layout(TableSectionBox.java:274)
    	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    please help[/QUOTE]

  2. #2
    Junior Member
    Join Date
    Apr 2018
    Thanked 0 Times in 0 Posts

    Default Re: generating pdf throgh itextrenderer throwing index out of bound exception

    Quote Originally Posted by dreamsshinu View Post
    i am also getting the same error did you got the solution?

Similar Threads

  1. throwing Exception
    By Syahdeini in forum Java Theory & Questions
    Replies: 3
    Last Post: August 4th, 2012, 06:05 PM
  2. Throwing Null Pointer Exception
    By SaurabhUpadhyay in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 11th, 2011, 05:47 AM
  3. Throwing an Exception in paintComponent
    By jmack in forum Exceptions
    Replies: 1
    Last Post: January 31st, 2011, 08:12 AM
  4. Problem with throwing an exception...
    By The_Mexican in forum What's Wrong With My Code?
    Replies: 9
    Last Post: January 23rd, 2011, 12:06 AM
  5. Saving .jsp page as .pdf file while generating report for struts based web application
    By ravindra_kumar_tiwari in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: August 12th, 2008, 09:32 AM

Tags for this Thread