我的iText pdf文档在IE中工作正常但在Firefox中不起作用。我得到了这个混乱的文字。
I{: 3 М֠ n:^;q0 v x ɕ y ~ E ?9 | f $ c“h Z f YR7L[ w9| H V0 x>B_ Z| SK dBnrS +;ɘaJǸ〜rfgq☄f[7 HТ W =`l : l ) 8C طى /N79 Ԛg % P (uE .e {,r 3 e Xw^ D 0rwi < Y x5 ި|⿊ 㹳w ܋ L .6 Z = 9ӆndndstreamendobj 126 0 obj<> / ProcSet [/ PDF / Text
以下是我的jsp代码。我看到了另一个类似问题的线程,但没有解决方案。任何帮助是极大的赞赏。我安装了Adobe Reader XI。如果您需要任何其他信息,请与我们联系。
Document document = new Document(PageSize.LETTER, widthMargin, widthMargin, heightMargin, heightMargin);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, baos);
document.open();
document.add(createImageTable(image1,image2));
document.close();
//response.setHeader("Expires", "0");
response.setContentType("application/pdf");
response.setHeader("Cache-Control",
"must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", "public");
// setting the content type
response.setContentType("application/pdf");
String countryName = filename.substring(filename.lastIndexOf('/')+1, filename.indexOf("."));
//String attachment = "attachment; filename=" + countryName + ".pdf";
String attachment = "inline; filename=" + countryName + ".pdf";
response.setHeader("Content-disposition",attachment);
response.setContentLength(baos.size());
// write ByteArrayOutputStream to the ServletOutputStream
OutputStream os = response.getOutputStream();
baos.writeTo(os);
os.flush();
os.close();
答案 0 :(得分:0)
Firefox中的pdfs原生阅读尚未实现(在Firefox 22.0上测试)。
您需要添加一个模块: Disable Built-in pdf viewer and use another viewer