我正在尝试将 source.fo 文件转换为Java中的 result.pdf 文件。
我正在寻找与调用Apache Fop命令相同的结果:
RewriteEngine on
RewriteCond %{QUERY_STRING} (?:^|&)target= [NC]
RewriteRule ^ /targets/ [R=301,L]
对于这个问题,可能不是一个重要的事实,但我已经设法使用freemarker模板创建了那些.fo文件,在我使用java fop库在Google上找到的所有示例中,他们使用xml创建了pdf和xsl-fo文件,不是我的情况。
我的B计划(我试图避免)包括调用系统命令。
提前感谢您的帮助。
答案 0 :(得分:2)
Save()
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" language="EN">
<fo:layout-master-set>
<fo:simple-page-master margin-right="5mm" margin-left="5mm" margin-bottom="5mm" margin-top="5mm" page-width="210mm" page-height="297mm" master-name="A4-portrail">
<fo:region-body margin-bottom="20mm" margin-top="25mm"/>
<fo:region-before precedence="true" display-align="before" extent="25mm" region-name="xsl-region-before"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4-portrail">
<fo:static-content flow-name="xsl-region-before">
<fo:table border-style="solid" border-width="0.4mm" border-color="black" font-size="10pt" width="100%" table-layout="fixed">
<fo:table-column column-width="proportional-column-width(20)"/>
<fo:table-column column-width="proportional-column-width(45)"/>
<fo:table-column column-width="proportional-column-width(20)"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-left="2mm" display-align="center" text-align="left">
<fo:block>1299Levent Divilioglu</fo:block>
</fo:table-cell>
<fo:table-cell display-align="center" text-align="center">
<fo:block font-size="150%">
<fo:basic-link external-destination="http://www.example.com">List of Month Records</fo:basic-link>
</fo:block>
<fo:block space-before="3mm"/>
</fo:table-cell>
<fo:table-cell padding-right="2mm" display-align="center" text-align="right">
<fo:block>19. Mayis Mah. No: 6 Kadikoy/Istanbul</fo:block>
<fo:block space-before="6mm" display-align="before">Page <fo:page-number/> . <fo:page-number-citation ref-id="end-of-document"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
<fo:flow reference-orientation="0" border-collapse="collapse" flow-name="xsl-region-body">
<fo:block>Records of Month</fo:block>
<fo:table space-after="5mm" display-align="center" text-align="center" border-style="solid" border-width="0.35mm" border-color="black" font-size="10pt" width="100%" table-layout="fixed">
<fo:table-column column-width="proportional-column-width(20)"/>
<fo:table-column column-width="proportional-column-width(30)"/>
<fo:table-column column-width="proportional-column-width(25)"/>
<fo:table-column column-width="proportional-column-width(50)"/>
<fo:table-body font-size="95%">
<fo:table-row height="8mm">
<fo:table-cell>
<fo:block>Date</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Called Number</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Price</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Discount Type</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>03-10-2016:19:25:03</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>505-999-88-77</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>12.95</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>4</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>08-10-2016:20:13:35</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>507-666-42-23</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>24.45</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>1</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>15-10-2016:17:47:34</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>535-234-44-54</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>21.34</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>3</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>21-10-2016:21:31:23</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>542-323-43-58</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>51.35</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>2</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block id="end-of-document">
<fo:instream-foreign-object>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="150mm" width="200mm">
<path style="fill:yellow;stroke:red;stroke-width:2" d="M153 334 C153 334 151 334 151 334 C151 339 153 344 156 344 C164 344 171 339 171 334 C171 322 164 314 156 314 C142 314 131 322 131 334 C131 350 142 364 156 364 C175 364 191 350 191 334 C191 311 175 294 156 294 C131 294 111 311 111 334 C111 361 131 384 156 384 C186 384 211 361 211 334 C211 300 186 274 156 274"/>
</svg>
</fo:instream-foreign-object>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>