我正在创建adf项目,并使用itextpdf 5.1.3生成报告。对于示例:-我的表客户有3000 rows.In,jspx页面有customer表&按钮有文件下载程序listner,我只是简单地调用报告。报告只生成前50行(最多4页)。为什么其余的行不会出现在报告中?
private void generatePDFFile(FacesContext facesContext, java.io.OutputStream outputStream) {
try {
DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iterBind1 = (DCIteratorBinding)dcBindings.get("CustomerView1Iterator");
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(FILE)); \\file path local disk D:\mywork\customer.pdf
document.open();
Row[] rows= iterBind1.getAllRowsInRange();
for(Row row:rows){
custcode = (String) row.getAttribute("CustomerCode");
custname = (String) row.getAttribute("CustomerNameE");
addgroup(document);
}
document.close();
facesContext = facesContext.getCurrentInstance();
ServletContext context = (ServletContext)facesContext.getExternalContext().getContext();
File file = new File(FILE);
FileInputStream fileInputStream;
byte[] b;
System.out.println(file.getCanonicalPath());
System.out.println(file.getAbsolutePath());
fileInputStream = new FileInputStream(file);
int n = fileInputStream.available();
while (n > 0) {
b = new byte[n];
//b = new byte[8192];
int result = fileInputStream.read(b);
outputStream.write(b, 0, b.length);
if (result == -1)
break;
}
outputStream.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
private static void addgroup(Document document) throws DocumentException{
Paragraph preface1 = new Paragraph();
Paragraph preface2 = new Paragraph();
preface1.add(new Chunk("\n"));
preface1.add(new Chunk("Customer : "+custcode+" "+custname,BlueFont));
preface1.add(new Chunk("\n"));
document.add(preface1);
document.add(preface2);
}发布于 2017-06-19 09:56:00
PDF文档中页面的最大大小为14,400乘14,400个用户单位。请参阅博客文章帮助,我只在PDF中看到空白页。。这不是iText引入的限制,而是PDF阅读器(如Adobe )中存在的限制。其他观看者(如Apple )显示更大页面的PDF没有问题。
这回答了你的帖子的主题行中的问题。
你的帖子正文包含一个完全不同的问题。也许您不是询问页面大小,而是询问文件大小。这一问题在过去也得到了回答。请参阅pdf文件的大小限制是多少?
请允许我总结一下这一答复:
因为您使用的是iText 5.1.3,所以您可以创建一个2 GBytes的PDF。我不明白为什么您使用的是从2011年11月开始的iText版本,而不是最近的版本,但是您没有理由不能将包含3000行的表放在一个可以大到2 GBytes的PDF中。
很可能你的代码很糟糕。不幸的是,你没有给我们看你的代码。你读过关于如何创建大桌子的文档了吗?
我不能评论你说的那部分:
在我的jspx页面中,有customer表&按钮有文件下载程序listner,我只是简单地调用报告。
这似乎与你的问题无关。
https://stackoverflow.com/questions/44627131
复制相似问题