繁体   English   中英

XMLWorkerHelper异常java.lang.IndexOutOfBoundsException:索引:11,大小:11

[英]XMLWorkerHelper Exception java.lang.IndexOutOfBoundsException: Index: 11, Size: 11

我正在尝试执行以下代码。 但是得到这个异常:

java.lang.IndexOutOfBoundsException:索引:11,大小:11

有谁知道导致此异常的原因以及如何解决该异常?

 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());
    }

我有同样的例外。 itext renderer.layout()存在空表行的问题:

自闭<tr/>在表中造成麻烦。 请尽可能选择以下结构: <tr><td></td></tr>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM