SeamFramework.orgCommunity Documentation
Seam now includes a component set for generating documents using iText. The primary focus of Seam's iText document support is for the generation of PDF documents, but Seam also offers basic support for RTF document generation.
iText support is provided by jboss-seam-pdf.jar
. This JAR contains the iText JSF controls, which are used to construct views that can render to PDF, and the DocumentStore component, which serves the rendered documents to the user. To include PDF support in your application, put jboss-seam-pdf.jar
in your WEB-INF/lib
directory along with the iText JAR file. There is no further configuration needed to use Seam's iText support.
Seam iText モジュールにはビューテクノロジーとして Facelets を使用する必要があります。 ライブラリの今後のバージョンも JSP の使用に対応する可能性があります。 また、 seam-ui パッケージの使用も必要となります。
examples/itext
プロジェクトには実行可能なデモ用 PDF サポートのサンプルが含まれています。 正確なパッケージ化の導入を行い、 現在サポートされている PDF 生成の主要な機能を実際に示すサンプルがいくつか含まれています。
|
詳細 ドキュメントは 属性
メタデータの属性
使い方 <p:document xmlns:p="http://jboss.com/products/seam/pdf" |
Useful documents will need to contain more than just text; however, the standard UI components are geared towards HTML generation and are not useful for generating PDF content. Instead, Seam provides a special UI components for generating suitable PDF content. Tags like <p:image>
and <p:paragraph>
are the basic foundations of simple documents. Tags like <p:font>
provide style information to all the content surrounding them.
|
詳細 テキストでの使用が多く、 文章をひとかたまりごとに区切るため理にかなったグループでテキストの断片の流れを作り、形成、スタイル化することができます。 属性
使い方 <p:paragraph alignment="justify"> |
|
詳細
属性
使い方 <p:paragraph> |
|
詳細
属性
使い方
|
|
詳細 フォントタグはその中のすべてのテキストに使用されるデフォルトフォントを定義します。 属性
使い方 <p:font name="courier" style="bold" size="24"> |
|
詳細
使い方 <p:newPage /> |
|
詳細
リソースはアプリケーションコードで動的に生成することもできます。 属性
使い方 <p:image value="/jboss.jpg" /> <p:image value="#{images.chart}" /> |
|
詳細
属性
使い方 <p:listItem |
|
詳細
属性
使い方 <f:facet name="header"> |
|
詳細 現在のページ番号は 使い方 <p:footer borderWidthTop="1" borderColorTop="blue" |
|
詳細 生成されるドキュメントが本または論文の構造をとる場合、 属性
使い方 <p:document xmlns:p="http://jboss.com/products/seam/pdf" |
|
詳細 いずれの章やセクションも |
List structures can be displayed using the p:list
and p:listItem
tags. Lists may contain arbitrarily-nested sublists. List items may not be used outside of a list. The following document uses the ui:repeat
tag to to display a list of values retrieved from a Seam component.
<p:document xmlns:p="http://jboss.com/products/seam/pdf"
xmlns:ui="http://java.sun.com/jsf/facelets"
title="Hello">
<p:list style="numbered">
<ui:repeat value="#{documents}" var="doc">
<p:listItem
>#{doc.name}</p:listItem>
</ui:repeat>
</p:list>
</p:document
>
|
属性
使い方 <p:list style="numbered"> |
|
詳細
属性
使い方 ... |
表の構成は p:table
と p:cell
のタグを使って作成することができます。 多くの表構成とは異なり明示的な列の宣言はありません。 表にコラムが 3 つある場合は、 3 セルすべてが自動的に列を形成します。 表の構成が複数ページに渡る場合、 ヘッダーとフッターは繰り返されます。
|
詳細
属性
使い方 <p:table columns="3" headerRows="1"> |
|
詳細
属性
使い方 <p:cell |
本セクションでは複数のタグで属性により共有される定数のいくつか説明します。
Several ways of specifying colors are provided. A limited number of colors are supported by name. They are: white
, gray
, lightgray
, darkgray
, black
, red
, pink
, yellow
, green
, magenta
, cyan
and blue
. Colors can be specified as an integer value, as definied by java.awt.Color
. Finally a color value may be specified as rgb(r,g,b)
or rgb(r,g,b,a)
with the red, green, blue alpha values specified as an integer between 0 and 255 or as a floating point percentages followed by a '%' sign.
Charting support is also provided with jboss-seam-pdf.jar
. Charts can be used in PDF documents or can be used as images in an HTML page. Charting requires the JFreeChart library (jfreechart.jar
and jcommon.jar
) to be added to the WEB-INF/lib
directory. Four types of charts are currently supported: pie charts, bar charts and line charts. Where greater variety or control is needed, it is possible to construct charts using Java code.
|
詳細 Displays a chart created in Java by a Seam component. 属性
使い方 <p:chart chart="#{mycomponent.chart}" width="500" height="500" /> |
|
詳細 棒グラフを表示します。 属性
使い方 <p:barchart title="Bar Chart" legend="true" |
|
詳細 折れ線グラフを表示します。 属性
使い方 <p:linechart title="Line Chart" |
|
詳細 円グラフを表示します。 属性
使い方 <p:piechart title="Pie Chart" circular="false" direction="anticlockwise" |
|
詳細 カテゴリデータはシリーズに分割できます。 シリーズタグを使ってデータセットをシリーズで分類しそのシリーズ全体にスタイリングを適用します。 属性
使い方 <p:series key="data1"> |
|
詳細 データタグはグラフ内で表示される各データポイントを表現します。 属性
使い方 <p:data key="foo" value="20" sectionPaint="#111111" |
|
詳細 色コンポーネントは色埋めされた形を描く場合に参照できる色または階調を宣言します。 属性
使い方 <p:color id="foo" color="#0ff00f"/> |
|
詳細 グラフ内に先途を描くのに使用する線を表します。 属性
使い方 <p:stroke id="dot2" width="2" cap="round" join="bevel" dash="2 3" /> |
Seam は iText を使って幅広い種類の形式でバーコードを生成することができます。 こうしたバーコードは PDF ドキュメントに埋め込んだり、 Web ページにイメージとして表示させたりすることができます。 HTML イメージを使用している場合、 現在バーコードはバーコード内でバーコードテキストを表示することができません。
|
詳細 バーコードイメージを表示します。 属性
使い方 <p:barCode type="code128" |
If you have a complex, pre-generated PDF with named fields, you can easily fill in the values from your application and present it to the user.
|
詳細 移植するフォームテンプレートを定義します。 属性
|
|
詳細 フィールド名をその値に接続します。 属性
|
<p:form
xmlns:p="http://jboss.com/products/seam/pdf"
URL="http://localhost/Concept/form.pdf">
<p:field name="person.name" value="Me, myself and I"/>
</p:form>
Seam は Swing コンポーネントを PDF イメージにレンダリングするサポートを実験的に提供するようになります。 いくつかの外観サポート、 特にネイティブウィジェットを使用するものは正しいレンダリングを行いません。
ドキュメントの生成は特に設定を必要とすることなく、 そのまま動作させることができます。 ただし、 本格的なアプリケーションには必要となる設定ポイントがいくつかあります。
デフォルト実装では汎用 URL /seam-doc.seam
から PDF ドキュメントを提供します。 ブラウザの多くは /myDocument.pdf
などのように実際の PDF 名を含んでいる URL を表示する傾向にあり、 またユーザーもそれを好みます。 これを行うにはいくつかの設定を必要とします。 PDF ファイルを提供するにはすべての *.pdf
リソースが DocumentStoreServlet にマッピングされなければなりません。
<servlet>
<servlet-name
>Document Store Servlet</servlet-name>
<servlet-class
>org.jboss.seam.document.DocumentStoreServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name
>Document Store Servlet</servlet-name>
<url-pattern
>*.pdf</url-pattern>
</servlet-mapping
>
ドキュメントストアのコンポーネントにある use-extensions
オプションはドキュメントストアに生成されるドキュメントタイプの正しいファイル名拡張子を付けて URL を生成するよう指示することでこれを行います。
<components xmlns="http://jboss.com/products/seam/components"
xmlns:document="http://jboss.com/products/seam/document"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://jboss.com/products/seam/document http://jboss.com/products/seam/document-2.1.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
<document:document-store use-extensions="true"/>
</components>
ドキュメントストアは対話スコープにドキュメントを格納し、 対話が終了するとドキュメントが終了します。 この時点でドキュメントへの参照は無効になります。 documentStore
の error-page
プロパティを使ってドキュメントが存在しない場合にデフォルトのビューが表示されるよう指定することができます。
<document:document-store use-extensions="true" error-page="/documentMissing.seam" />