首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >XMLWorkerHelper异常java.lang.IndexOutOfBoundsException:索引: 11,大小: 11

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

Stack Overflow用户
提问于 2016-11-18 09:33:12
回答 1查看 475关注 0票数 0

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

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

有没有人知道是什么导致了这个异常以及如何解决它?

代码语言:javascript
复制
 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());
    }
EN

回答 1

Stack Overflow用户

发布于 2017-06-21 15:42:55

我也有同样的例外。Itext renderer.layout()在处理空表行时存在问题:

自动关闭的<tr/>会在表中造成麻烦。如果可能,请选择此结构:<tr><td></td></tr>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40668003

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档