|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | 列挙型定数 | フィールド | メソッド | 詳細: 列挙型定数 | フィールド | メソッド | |||||||||
java.lang.Objectjava.lang.Enum<FopUtil>
jp.co.fujitsu.reffi.server.util.FopUtil
public enum FopUtil
[概 要]
Apache FOPを使用するためのユーティリティクラスです。[詳 細]
Apache FOPを使用するためメソッドを提供します。[備 考]
| 列挙型定数の概要 | |
|---|---|
instance
インスタンス |
|
| メソッドの概要 | |
|---|---|
void |
convertDOM2PDF(Document foDom,
File pdf,
String configPath)
[概 要] DOM(XSL-FOフォーマット)より、PDFを作成します。 |
void |
convertFO2PDF(File fo,
File pdf,
String configPath)
[概 要] XSL-FOファイルより、PDFを作成します。 |
void |
convertObj2PDF(Object obj,
File xslt,
File pdf,
String configPath)
[概 要] Objectより、PDFを作成します。 |
void |
convertObj2XML(Object obj,
File xml)
[概 要] Objectより、XMLを作成します。 |
void |
convertSVG2PDF(File svg,
File pdf)
[概 要] SVGより、PDFを作成します。 |
void |
convertXML2FO(File xml,
File xslt,
File fo)
[概 要] XML + XSLTファイルより、XSL-FOファイルを作成します。 |
void |
convertXML2PDF(File xml,
File xslt,
File pdf,
String configPath)
[概 要] XML + XSLTファイルより、PDFを作成します。 |
static FopUtil |
valueOf(String name)
指定した名前を持つこの型の列挙型定数を返します。 |
static FopUtil[] |
values()
この列挙型の定数を含む配列を宣言されている順序で返します。 |
| クラス java.lang.Enum から継承されたメソッド |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| クラス java.lang.Object から継承されたメソッド |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| 列挙型定数の詳細 |
|---|
public static final FopUtil instance
| メソッドの詳細 |
|---|
public static FopUtil[] values()
for (FopUtil c : FopUtil.values()) System.out.println(c);
public static FopUtil valueOf(String name)
name - 返される列挙型定数の名前
IllegalArgumentException - 指定された名前を持つ定数を
この列挙型が持っていない場合
NullPointerException - 引数が null の場合
public void convertFO2PDF(File fo,
File pdf,
String configPath)
throws jp.co.fujitsu.reffi.common.exception.CoreLogicException
[概 要]
XSL-FOファイルより、PDFを作成します。(XSL-FO -> PDF)[詳 細]
XSL-FOファイルより、PDFを作成します。(XSL-FO -> PDF) (呼び出しサンプル)
public static void main(String[] args) {
try {
File baseDir = new File("bin");
File outDir = new File(baseDir, "out");
outDir.mkdirs();
File fofile = new File(baseDir, "作成元FOファイル.fo");
File pdffile = new File(outDir, "出力PDFファイル.pdf");
FopUtil.getInstance().convertFO2PDF(fofile, pdffile, "FOP設定ファイルパス");
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
[備 考]
fo - XSL-FOファイルpdf - PDFファイルconfigPath - 設定ファイルパス
jp.co.fujitsu.reffi.common.exception.CoreLogicException - FOP処理例外
public void convertXML2FO(File xml,
File xslt,
File fo)
throws jp.co.fujitsu.reffi.common.exception.CoreLogicException
[概 要]
XML + XSLTファイルより、XSL-FOファイルを作成します。(XML + XSLT -> XSL-FO)[詳 細]
XML + XSLTファイルより、XSL-FOファイルを作成します。(XML + XSLT -> XSL-FO) (呼び出しサンプル)
public static void main(String[] args) {
try {
File baseDir = new File("bin");
File outDir = new File(baseDir, "out");
outDir.mkdirs();
File xmlfile = new File(baseDir, "作成元XMLファイル.xml");
File xsltfile = new File(baseDir, "作成元XSLTファイル.xsl");
File fofile = new File(outDir, "出力FOファイル.fo");
FopUtil.getInstance().convertXML2FO(xmlfile, xsltfile, fofile);
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
[備 考]
xml - XMLファイルxslt - XSLTファイルfo - FOファイル
jp.co.fujitsu.reffi.common.exception.CoreLogicException - FOP処理例外
public void convertXML2PDF(File xml,
File xslt,
File pdf,
String configPath)
throws jp.co.fujitsu.reffi.common.exception.CoreLogicException
[概 要]
XML + XSLTファイルより、PDFを作成します。(XML -> XSL-FO -> PDF)[詳 細]
XML + XSLTファイルより、PDFを作成します。(XML -> XSL-FO -> PDF) (呼び出しサンプル)
public static void main(String[] args) {
try {
File baseDir = new File("bin");
File outDir = new File(baseDir, "out");
outDir.mkdirs();
File xmlfile = new File(baseDir, "作成元XMLファイル.xml");
File xsltfile = new File(baseDir, "作成元XSLTファイル.xsl");
File pdffile = new File(outDir, "出力PDFファイル.pdf");
FopUtil.getInstance().convertXML2PDF(xmlfile, xsltfile, pdffile, "FOP設定ファイルパス");
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
[備 考]
xml - XMLファイルxslt - XSLTファイルpdf - PDFファイルconfigPath - 設定ファイルパス
jp.co.fujitsu.reffi.common.exception.CoreLogicException - FOP処理例外
public void convertObj2XML(Object obj,
File xml)
throws jp.co.fujitsu.reffi.common.exception.CoreLogicException
[概 要]
Objectより、XMLを作成します。(Object -> XML)[詳 細]
Objectより、DOMを作成します。(Object -> XML) XMLEncoderを使用して、オブジェクトをXMLに出力します。[備 考]
obj - Object
jp.co.fujitsu.reffi.common.exception.CoreLogicException - FOP処理例外
public void convertObj2PDF(Object obj,
File xslt,
File pdf,
String configPath)
throws jp.co.fujitsu.reffi.common.exception.CoreLogicException
[概 要]
Objectより、PDFを作成します。(Object -> XML + XSLT -> PDF)[詳 細]
Objectより、PDFを作成します。(Object -> XML + XSLT -> PDF) XMLEncoderを使用して、オブジェクトをPDFに出力します。[備 考]
obj - Objectxslt - XSLファイルpdf - PDFファイルconfigPath - 設定ファイルパス
jp.co.fujitsu.reffi.common.exception.CoreLogicException - FOP処理例外
public void convertDOM2PDF(Document foDom,
File pdf,
String configPath)
throws jp.co.fujitsu.reffi.common.exception.CoreLogicException
[概 要]
DOM(XSL-FOフォーマット)より、PDFを作成します。(DOM -> PDF)[詳 細]
DOM(XSL-FOフォーマット)より、PDFを作成します。(DOM -> PDF) (呼び出しサンプル)
private static Document buildDOMDocument() throws ParserConfigurationException {
Document foDoc = null;
Element root = null, ele1 = null, ele2 = null, ele3 = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
foDoc = db.newDocument();
root = foDoc.createElementNS(foNS, "fo:root");
foDoc.appendChild(root);
ele1 = foDoc.createElementNS(foNS, "fo:layout-master-set");
root.appendChild(ele1);
ele2 = foDoc.createElementNS(foNS, "fo:simple-page-master");
ele1.appendChild(ele2);
ele2.setAttributeNS(null, "master-name", "letter");
ele2.setAttributeNS(null, "page-height", "11in");
ele2.setAttributeNS(null, "page-width", "8.5in");
ele2.setAttributeNS(null, "margin-top", "1in");
ele2.setAttributeNS(null, "margin-bottom", "1in");
ele2.setAttributeNS(null, "margin-left", "1in");
ele2.setAttributeNS(null, "margin-right", "1in");
ele3 = foDoc.createElementNS(foNS, "fo:region-body");
ele2.appendChild(ele3);
ele1 = foDoc.createElementNS(foNS, "fo:page-sequence");
root.appendChild(ele1);
ele1.setAttributeNS(null, "master-reference", "letter");
ele2 = foDoc.createElementNS(foNS, "fo:flow");
ele1.appendChild(ele2);
ele2.setAttributeNS(null, "flow-name", "xsl-region-body");
addElement(ele2, "fo:block", "Hello World!");
return foDoc;
}
protected static void addElement(Node parent, String newNodeName,
String textVal) {
if (textVal == null) {
return;
} // use only with text nodes
Element newElement = parent.getOwnerDocument().createElementNS(
foNS, newNodeName);
Text elementText = parent.getOwnerDocument().createTextNode(textVal);
newElement.appendChild(elementText);
parent.appendChild(newElement);
}
public static void main(String[] args) {
try {
File baseDir = new File("bin");
File outDir = new File(baseDir, "out");
outDir.mkdirs();
File pdffile = new File(outDir, "出力PDF.pdf");
Document foDoc = buildDOMDocument();
FopUtil.getInstance().convertDOM2PDF(foDoc, pdffile, "FOP設定ファイルパス");
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
[備 考]
foDom - XSL-FO形式のDOMpdf - PDFファイルconfigPath - 設定ファイルパス
jp.co.fujitsu.reffi.common.exception.CoreLogicException - FOP処理例外
public void convertSVG2PDF(File svg,
File pdf)
throws jp.co.fujitsu.reffi.common.exception.CoreLogicException
[概 要]
SVGより、PDFを作成します。(SVG -> PDF)[詳 細]
SVGより、PDFを作成します。(SVG -> PDF) (呼び出しサンプル)
public static void main(String[] args) {
try {
File baseDir = new File("bin");
File outDir = new File(baseDir, "out");
outDir.mkdirs();
File svgfile = new File(baseDir, "作成元SVG.svg");
File pdffile = new File(outDir, "出力PDF.pdf");
FopUtil.getInstance().convertSVG2PDF(svgfile, pdffile);
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
[備 考]
svg - SVGファイルpdf - PDFファイル
jp.co.fujitsu.reffi.common.exception.CoreLogicException - FOP処理例外
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | 列挙型定数 | フィールド | メソッド | 詳細: 列挙型定数 | フィールド | メソッド | |||||||||