在Seam iText中创建标记的PDF文档
我正在尝试使用Seam及其可访问的PDF http://docs.jboss.org/seam/snapshot/en-US/html/itext.html\"rel =nofollow> iText实施。我找不到任何关于这是否可行的参考。似乎iText本身可以处理它; 此示例上的PDF已标记。但是我们创建的所有PDF都不是,我似乎无法弄清楚如何添加它。
I am trying to create an accessible PDF using Seam and their iText implementation. I cannot find any references to whether or not this is possible. It seems that iText itself can handle it; the PDF on this example is tagged. But all of the PDFs that we create aren't and I can't seem to figure out how to add it.
以下是我们其中一个文档的示例代码:
Here's some sample code from one of our documents:
<?xml version="1.0" encoding="UTF-8"?>
<p:document xmlns:p="http://jboss.com/products/seam/pdf" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:h="http://java.sun.com/jsf/html" type="PDF" pageSize="letter" title="Letter" margins="15.0 40.0 20.0 10.0">
<f:facet name="header">
<p:font size="10" name="TIMES-ROMAN" style="bold">
<p:header borderWidth="0"/>
<p:footer borderWidthTop="0" borderWidthBottom="0" alignment="center">
FY #{handler.form.year}<p:text value=" #{handler.form.name}"/><p:text value=" "/>CAN #{handler.form.number}<p:text value=" "/>Object Class #{handler.form.class}<p:text value=" "/>#{handler.form.time}
</p:footer>
</p:font>
</f:facet>
<p:font size="10" name="TIMES-ROMAN">
<p:table columns="3" widthPercentage="100" widths="1 2 1">
<p:cell borderWidth="0">
<p:image alignment="left" value="/assets/img/logo.PNG" scalePercent="5"/>
</p:cell>
<p:cell borderWidth="0" horizontalAlignment="center" paddingTop="30">
<p:paragraph>
WORKSHEET
</p:paragraph>
</p:cell>
... snip ...
我意识到这不是最好的代码(我'我只是从文件中拉出来,我需要清理)。关于Seam是否可以实际放入PDF标签的任何想法?
I realize that's not the best code (I'm just pulling from a document I'll need to clean up). Still, any ideas on if Seam can actually put in PDF tags?
支持开箱即用的标记PDF因为iText 5.4.0(这是最新版本)。
Out-of-the-box tagged PDF is supported since iText 5.4.0 (which is the most recent version).
当您使用Paragraph,PdfPTable等高级对象时...并且您使用PdfWriter.setTagged(),然后你就可以得到质量好的Tagged PDF。你甚至可以选择自己的角色。
When you use the high-level objects such as Paragraph, PdfPTable, etc... and you use PdfWriter.setTagged(), then you get good quality Tagged PDF. You can even choose your own roles.
如果jBoss / SEAM将使用这样一个最近版本的iText,我会感到惊讶。我已经联系他们进行升级,SEAM团队从未做出回应。 (我是谁?我是iText Software的首席执行官。)
It would surprise me if jBoss/SEAM would be using such a recent version of iText. I've reached out to them to upgrade and the SEAM team never responded. (Who am I? I'm the CEO of iText Software.)