关闭文档itext sharp [英] Close a document itext sharp

查看:154
本文介绍了关闭文档itext sharp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for(int i-=0; i<firstitems.size();>{
    table.addCell(String.valueOf(firstItems.get(z)));
    document.add(table);
    document.close();
    response.addHeader("Content-Disposition", "attachment; filename="test.pdf");
    OutputStream out = response.getOutputStream();
    baos.writeTo(out);
    out.flush();
}





我收到错误,说明文件已经关闭。你可以添加任何元素。



Hi I got an error stating the document has been closed. You can't add any Elements.

推荐答案

如果你自己明确关闭它,可能会在错误中说明文档已经关闭中有什么不清楚?



此外,y你循环关闭文档。你添加一些东西,关闭它,在循环中做一些其他事情。在第二次迭代中,您尝试添加到已关闭的文档。



-SA
What could possibly unclear in the error "stating the document has been closed", if you explicitly close it yourself?

Moreover, you close the document in loop. You add something, close it, do something else inside the loop. On second iteration, you try to add to a closed document.

—SA


这篇关于关闭文档itext sharp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆