2016-11-18 11 views
0

아래 코드를 실행하려고합니다. 크기, 11 : 11XMLWorkerHelper 예외 java.lang.IndexOutOfBoundsException : 인덱스 : 11, 크기 : 11

사람이 예외의 원인을 어떤 생각을 가지고 있으며, 그것을 어떻게 해결합니까

java.lang.IndexOutOfBoundsException : 인덱스 그러나이 예외를 받고?

private ByteArrayInputStream getByteArrayInputStream(Document doc) throws DocumentException, IOException { 
     InputStream pdfStream = new ByteArrayInputStream(doc.html().getBytes()); 
     ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); 
     com.itextpdf.text.Document document = new com.itextpdf.text.Document(PageSize.LETTER); 
     PdfWriter writer = PdfWriter.getInstance(document, bytesOut); 
     document.open();   
     try{ 
     XMLWorkerHelper.getInstance().parseXHtml(writer, document, pdfStream, Charset.forName("UTF-8")); 
     }  
      catch(IOException ioe){ 
       System.out.println(ioe.getMessage()); 
       ioe.printStackTrace(); 
      }catch(Exception e){ 
       e.printStackTrace(); 
      } 
     document.close(); 
     return new ByteArrayInputStream(bytesOut.toByteArray()); 
    } 
+0

지금이 경우 어떻게 될까요? –

+0

문서를 pdf로 변환하려고합니다. – Ashwini

+0

아니요, 위의 게시 된 코드는 어디에서 발생합니까? 스택 추적을 게시하는 방법은 어떻습니까? –

답변

0

나는 같은 예외가있었습니다. Itext renderer.layout()에는 빈 테이블 행에 문제가 있습니다.

자동 마감 <tr/>은 테이블에 문제가 있습니다. 가능한 경우이 구조체를 선택하십시오. <tr><td></td></tr>