我正在使用iText 5.5.3生成PDF文件。我用来生成文件的示例java代码如下:
Rectangle pageConfig = PageSize.A4;
Document doc = new Document(pageConfig);
try {
PdfWriter writer = PdfWriter.getInstance(doc, out);
writer.setPdfVersion(PdfWriter.PDF_VERSION_1_7);
String country = Locale.getDefault().getLanguage();
writer.setTagged();
doc.addTitle(fileTitle);
writer.setViewerPreferences(PdfWriter.DisplayDocTitle);
doc.addLanguage(country);
writer.createXmpMetadata();
doc.open();
for (Iterator iter = this.elements.iterator(); iter.hasNext();) {
Object elt = iter.next();
//adding the itext high level blocks to the pdf doc
this.process(doc, elt);
}
doc.close();
} catch (DocumentException ex) {
throw new IOException(ex.getMessage());
}
使用所有标签正确生成PDF文件,但是当我尝试使用JAWS(屏幕阅读器软件)阅读相同的pdf时,它只是宣布文件的标题。它不会读取文件的内容。你能告诉我们上面代码中缺少什么吗?
在此处下载生成的pdf: https://www.dropbox.com/s/8nhwo5km25gjcm0/License_Mgmt_Report_Domain_INW00005159%20%2810%29.pdf?dl=0