- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
-6ren">
我希望 column-count="2"只出现在页面的某些部分。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fo:root [
<!ENTITY nbsp " ">
]>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4"
page-width="21cm"
page-height="29.7cm" >
<fo:region-body
margin-bottom="1.5cm"
margin-right="2cm"
margin-left="2cm"
margin-top="1.5cm"
column-count="2"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="NOCOLUMN"
page-width="21cm"
page-height="29.7cm" >
<fo:region-body
margin-bottom="1.5cm"
margin-right="2cm"
margin-left="2cm"
margin-top="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:bookmark-tree>
<fo:bookmark internal-destination="sec0">
<fo:bookmark-title>Adding Fonts to FOP</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec1">
<fo:bookmark-title>Adding additional Type 1 fonts</fo:bookmark-title>
<fo:bookmark internal-destination="sec1-1">
<fo:bookmark-title>Generating a font metrics file</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec1-2">
<fo:bookmark-title>Register the fonts within FOP</fo:bookmark-title>
</fo:bookmark>
</fo:bookmark>
<fo:bookmark internal-destination="sec2">
<fo:bookmark-title>Adding additional TrueType fonts</fo:bookmark-title>
<fo:bookmark internal-destination="sec2-1">
<fo:bookmark-title>Generating a font metrics file</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec2-2">
<fo:bookmark-title>TrueType collections</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec2-3">
<fo:bookmark-title>Register the fonts within FOP</fo:bookmark-title>
</fo:bookmark>
</fo:bookmark>
<fo:bookmark internal-destination="sec3">
<fo:bookmark-title>Embedding fonts in the PDF</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec4">
<fo:bookmark-title>Example embedding MSGothic</fo:bookmark-title>
<fo:bookmark internal-destination="sec4-1">
<fo:bookmark-title>Setup CLASSPATH</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec4-2">
<fo:bookmark-title>Create the metrics file</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec4-3">
<fo:bookmark-title>Edit msgothic.xml</fo:bookmark-title>
</fo:bookmark>
<fo:bookmark internal-destination="sec4-4">
<fo:bookmark-title>Register the font with FOP</fo:bookmark-title>
</fo:bookmark>
</fo:bookmark>
<fo:bookmark internal-destination="sec5">
<fo:bookmark-title>Japanese Examples</fo:bookmark-title>
</fo:bookmark>
</fo:bookmark-tree>
<fo:page-sequence master-reference="NOCOLUMN">
<fo:flow flow-name="xsl-region-body">
<fo:wrapper font-family="Times" font-size="12pt" text-align="justify">
<fo:block id="sec0"
text-align="center"
font-family="Helvetica"
font-weight="bold"
font-size="18pt"
color="#0050B2" space-after.optimum="6pt">
Adding Fonts to FOP
</fo:block>
<fo:block space-after.optimum="6pt">
When building PDF files, FOP normally supports only the base 14 font
package defined in the Adobe PDF specification. That includes the
following fonts: Helvetica, Times, Courier, Symbol and ZapfDingbats.
</fo:block>
<fo:block space-after.optimum="6pt">
Font support in FOP can be extended by the addition of font metric
files (written in XML) created from Adobe Type 1 fonts and Truetype
fonts. No other font types (Type 3, etc.) are supported at this time.
</fo:block>
</fo:wrapper>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="A4">
<fo:flow flow-name="xsl-region-body">
<fo:wrapper font-family="Times" font-size="12pt" text-align="justify">
<fo:block id="sec1"
font-family="Helvetica"
font-weight="bold"
font-size="14pt"
color="#0050B2"
space-after.optimum="6pt"
space-before.optimum="12pt">
Adding additional Type 1 fonts
</fo:block>
<fo:block space-after.optimum="6pt" >
As mentioned above you need an XML file containing font metrics to
be able to use an additional font. FOP contains a tool that can generate
such a font metrics file from a PFM file, which normally comes with the
font file.
</fo:block>
<fo:block id="sec1-1"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt" >
Generating a font metrics file
</fo:block>
<fo:block space-after.optimum="6pt" >
Run the class <fo:inline font-family="Courier">org.apache.fop.fonts.apps.PFMReader</fo:inline>
to generate the XML file.
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt" space-after.optimum="6pt" margin-left="6pt" text-align="start">
java org.apache.fop.fonts.apps.PFMReader pfm-file xml-file
</fo:block>
</fo:block>
<fo:block space-after.optimum="6pt" margin-left="6pt">
Note: The tool will construct some values (FontBBox, StemV and ItalicAngle) based
on assumptions and calculations which are only an approximation to the real values.
FontBBox and Italic Angle can be found in the human-readable part of the PFB file.
The PFMReader tool does not yet interpret PFB files, so if you want to be correct,
you may have to adjust the values in the XML file manually. The constructed values
however appear to have no visible influence.
</fo:block>
<fo:block id="sec1-2"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt" >
Register the fonts within FOP
</fo:block>
<fo:block space-after.optimum="6pt">
Edit conf/userconfig.xml and add entries for the font if the fonts section, ie:
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt"
white-space-collapse="false" margin-left="6pt" text-align="start">
<![CDATA[
<font metrics-file="cyberbit.xml" kerning="yes" embed-file="C:\WINNT\Fonts\Cyberbit.ttf">
<font-triplet name="Cyberbit" style="normal" weight="normal">
</font>]]></fo:block>
</fo:block>
<fo:block id="sec2"
font-family="Helvetica"
font-weight="bold"
font-size="14pt"
color="#0050B2"
space-after.optimum="6pt"
space-before.optimum="12pt">
Adding additional TrueType fonts
</fo:block>
<fo:block space-after.optimum="6pt">
Adding Truetype fonts is almost identical to the process of adding type 1 fonts.
The main difference is in the first step.
</fo:block>
<fo:block id="sec2-1"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt" >
Generating a font metrics file
</fo:block>
<fo:block space-after.optimum="6pt">
As mentioned above you need an XML file containing font metrics to be able to use
an additional font. FOP contains a tool that can generate such a font metrics file
from your truetype font file.
</fo:block>
<fo:block space-after.optimum="6pt">
Create metrics for the fontfile. We'll use MS Gothic as an example:
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt" space-after.optimum="6pt" margin-left="6pt" text-align="start">
java org.apache.fop.fonts.apps.TTFReader C:\WINNT\Fonts\msgothic.ttf msgothic.xml
</fo:block>
</fo:block>
<fo:block id="sec2-2"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt" >
TrueType collections
</fo:block>
<fo:block space-after.optimum="6pt">
TrueType collections (.ttc files) contains more than one font. To create metrics
for a ttc file you must specify the font in the collection with the -ttcname
option to TTFReader.
</fo:block>
<fo:block space-after.optimum="6pt">
To get a list of the fonts in a collection, just start the TTFReader as if it
were a normal truetype file (without the -ttcname option). It will then display
all the font names and exit with an Exception.
</fo:block>
<fo:block space-after.optimum="6pt">
Example on generating metrics for a .ttc file:
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt" space-after.optimum="6pt" margin-left="6pt" text-align="start">
java org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" msmincho.ttc msminch.xml
</fo:block>
</fo:block>
<fo:block id="sec2-3"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt" >
Register the fonts within FOP
</fo:block>
<fo:block space-after.optimum="6pt">
Same as for <fo:basic-link internal-destination="sec1-2" color="blue">
<fo:inline text-decoration="underline">Type 1 fonts</fo:inline></fo:basic-link>.
</fo:block>
<fo:block id="sec3"
font-family="Helvetica"
font-weight="bold"
font-size="14pt"
color="#0050B2"
space-after.optimum="6pt"
space-before.optimum="12pt">
Embedding fonts
</fo:block>
<fo:block space-after.optimum="6pt">
Font embedding is enabled in the userconfig.xml file. Start Fop with -c userconfig.xml
</fo:block>
<fo:block id="sec4"
font-family="Helvetica"
font-weight="bold"
font-size="14pt"
color="#0050B2"
space-after.optimum="6pt"
space-before.optimum="12pt">
Example embedding MSGothic
</fo:block>
<fo:block space-after.optimum="6pt">
This example will use the Microsoft Gothic TrueType font. This is the font used to render this examples
given in the last section of this file. If you don't have it installed,
you can download an installer at <fo:basic-link color="blue"
external-destination="ftp://ftp.cc.monash.edu.au/pub/nihongo/ie3lpkja.exe">
<fo:inline text-decoration="underline">ftp://ftp.cc.monash.edu.au/pub/nihongo/ie3lpkja.exe</fo:inline>
</fo:basic-link>.
</fo:block>
<fo:block id="sec4-1"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt">
Setup your classpath to run FOP:
</fo:block>
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt"
white-space-collapse="false" margin-left="6pt" text-align="start">
C:\Fop-0.18.1> set CLASSPATH=fop.jar;lib\xerces-1.2.3.jar;lib\xalan-2.0.0.jar;lib\batik.jar
</fo:block>
<fo:block id="sec4-2"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt">
Create the metrics file:
</fo:block>
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt"
white-space-collapse="false" margin-left="6pt" text-align="start">
C:\Fop-0.18.1> java org.apache.fop.fonts.apps.TTFReader c:\WINNT\Fonts\msgothic.ttf msgothic.xml
TTF Reader v1.1.1
Reading /home/camk/cjkv/msgothic.ttf...
Number of glyphs in font: 13104
Postscript format 3
Creating xml font file...
Creating CID encoded metrics
Writing xml font file msgothic.xml...
This font contains no embedding license restrictions
</fo:block>
<fo:block id="sec4-3"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt">
Edit the msgothic.xml file and set the <fo:inline font-family="Courier">font-name</fo:inline>
to "MSGothic".
</fo:block>
<fo:block id="sec4-4"
font-family="Helvetica"
font-weight="bold"
space-after.optimum="6pt"
space-before.optimum="12pt">
Edit conf/userconfig.xml and add the following to the <fonts> section:
</fo:block>
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt"
white-space-collapse="false" margin-left="6pt" text-align="start">
<![CDATA[
<font metrics-file="msgothic.xml" kerning="yes"
embed-file="C:\WINNT\Fonts\msgothic.ttf">
<font-triplet name="MSGothic" style="normal" weight="normal"/>
</font>
]]>
</fo:block>
<fo:block space-after.optimum="6pt">
Now you can use MSGothic in your .fo files by setting font-family="MSGothic". You'll need to
start FOP specifying the config file as in this example:
<fo:block font-family="Courier" font-size="10pt"
space-before.optimum="6pt"
white-space-collapse="false" margin-left="6pt" text-align="start"
>java -jar fop.jar -c conf/userconfig.xml -fo myfo.fo -pdf mypdf.pdf</fo:block>
</fo:block>
<fo:block id="sec5"
font-family="Helvetica"
font-weight="bold"
font-size="14pt"
color="#0050B2"
space-after.optimum="6pt"
space-before.optimum="12pt">
Examples from <fo:basic-link color="blue" external-destination="http://www.csse.monash.edu.au/~jwb/j_jmdict.html">
<fo:inline text-decoration="underline">JMDict</fo:inline></fo:basic-link> Japanese glossary:
</fo:block>
</fo:wrapper>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="50mm"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell ><fo:block font-weight="bold" font-family="Helvetica">Japanese (kanji or kanadzukai)</fo:block></fo:table-cell>
<fo:table-cell ><fo:block font-weight="bold" font-family="Helvetica">English</fo:block></fo:table-cell>
<fo:table-cell ><fo:block font-weight="bold" font-family="Helvetica">German</fo:block></fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">うん</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>"yeah" or "uh huh"</fo:block></fo:table-cell>
<fo:table-cell ><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">アウタースペース</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>outer space</fo:block></fo:table-cell>
<fo:table-cell ><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">スペースクラフト</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>spacecraft</fo:block></fo:table-cell>
<fo:table-cell ><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">スペースシャトル</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>space shuttle</fo:block></fo:table-cell>
<fo:table-cell ><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">著わす</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>"to write", "to publish"</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>veröffentlichen</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">電子出版</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>electronic publishing</fo:block></fo:table-cell>
<fo:table-cell ><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">五輪</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>the Olympics</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Olympische Spiele</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">空港</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>airport</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Flughafen</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">チューリッヒ</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Zurich</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Zürich</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">コロラド</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Colorado</fo:block></fo:table-cell>
<fo:table-cell ><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell ><fo:block font-family="MSGothic">コロラドスプリングス</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Colorado Springs</fo:block></fo:table-cell>
<fo:table-cell ><fo:block></fo:block></fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
最佳答案
您可以始终使用“A4”布局(具有两列的布局)。对于跨越两列的块,您必须添加
span="all"
<fo:page-sequence master-reference="A4">
<fo:flow flow-name="xsl-region-body">
<fo:wrapper font-family="Times" font-size="12pt" text-align="justify">
<fo:block id="sec0"
text-align="center"
font-family="Helvetica"
font-weight="bold"
font-size="18pt"
color="#0050B2" space-after.optimum="6pt"
span="all">
Adding Fonts to FOP
</fo:block>
<fo:block space-after.optimum="6pt" span="all">
When building PDF files, FOP normally supports only the base 14 font
package defined in the Adobe PDF specification. That includes the
following fonts: Helvetica, Times, Courier, Symbol and ZapfDingbats.
</fo:block>
<fo:block space-after.optimum="6pt" span="all">
Font support in FOP can be extended by the addition of font metric
files (written in XML) created from Adobe Type 1 fonts and Truetype
fonts. No other font types (Type 3, etc.) are supported at this time.
</fo:block>
<fo:block id="sec1"
font-family="Helvetica"
font-weight="bold"
font-size="14pt"
color="#0050B2"
space-after.optimum="6pt"
space-before.optimum="12pt">
Adding additional Type 1 fonts
</fo:block>
<fo:block space-after.optimum="6pt" >
As mentioned above you need an XML file containing font metrics to
be able to use an additional font. FOP contains a tool that can generate
such a font metrics file from a PFM file, which normally comes with the
font file.
</fo:block>
关于xsl-fo - 如何仅在页面的某些部分使用列数 ="2"(XSL-FO),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15493782/
我有一个 XML 输入文件,可以说 shipnote.xml其中包含一个零件项目列表。部分项目具有通常的属性 qty , partno和 label .每个项目都分配给一个 packetno . 我写
我们客户的要求是提供带圆角的 PDF 表格。我只有 Apache FOP 处理器可供我使用,它不支持圆角属性。它也不支持 float ,因此无法向左和向右 float 圆形图像。 你对如何做到这一点有
我的 FO 流程有问题,因为在一页上,标题显示在一页的末尾并在之后的页面上继续。如何向 title-element 添加属性,以便标题始终显示在同一页面上,这意味着:没有分页符。 谢谢! /丹尼 最佳
我希望 column-count="2"只出现在页面的某些部分。 ]>
我正在为我的 XML 内容生成 xsl-fo 文档,然后将此内容传递给将生成 PDF 的第三方 DLL 之一。我需要以 45 度角显示测试。如何实现这一目标? 谢谢 最佳答案 我很确定您不能在纯 XS
在我的情况下,我必须在两个表格行之间提供高达 0.5cm 的空间。我怎样才能做到这一点。 代码:: 我用过了:
我正在从我的 xsl 和 xml 文件生成一个 pdf,其中我需要在第一页的末尾显示一个表格。但是由于该表格上方还有一些表格,将其显示为静态文本会将其向下推到第 2 页(或第 3 页,依此类推)。所以
我正在从 xml 和 xsl-fo 以及 Apache FOP 创建一个 pdf 文件,我需要在一行上写文本。我的意思是类似于手工编辑的表格,你可以在其中写上名字、姓氏等。是这样的:姓名:______
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
在我的 XSL 页面主代码看起来像这样......
我有一些很长的表格,它们跨越多个页面,用 Apache-FOP 1.1 呈现 表格有标题,例如“表 7.6. 事物的详细信息”和列标题。 在每个连续页面上,列标题在顶部正确重复。但我还需要让表格延续也
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 2年前关闭。 Improve t
我创建了一个 XSL-FO 模板,它打印了一些包含动态变化的文本的块。有时一个块被分成两页,因为页面上没有足够的空间。有没有办法将块放在下一页而不是在不适合的情况下将其拆分到页面上?我试图将它放入一个
我有一个非常简单的模板: 我如何告诉DO即使块为空也要保留空行。 最佳答案 只需在的末尾添加一个元素。像这样:
我有一个 fo:block 可能跨越一个页面。我想在该 block 所在的第一页的底部放置一些文本,例如“继续”。 源文档在 标记内有一系列 。 我认为做到这一点的唯一方法是在源文档的正确位置添加下一
我为 sp_sign 获得的值(如下所示)我想将其用作 fo:external graphics 的 src 。我尝试了很多事情仍然没有运气请帮助。 // 提前致谢 问候,
我正在使用 XSL:FO 和 Apache FOP 创建可访问的文档。要确认可访问性,PDF Accesibility Checker 3 (PAC3)应该使用。不幸的是,检查器提示每个表格单元格边框
我正在使用 XSL:FO 和 Apache FOP 创建可访问的文档。要确认可访问性,PDF Accesibility Checker 3 (PAC3)应该使用。不幸的是,检查器提示每个表格单元格边框
我正在以这种方式在 XSL FO 文档中创建背景文本: Background Watermark Text
我有一个 .xml 文件,我想生成一个 .pdf 文件。我使用 xsl-fo 来实现这一点。 问题是我无法请求当前页面的编号以将其存储到变量中,而是根据其值做出不同的事情。 具体:如果当前页面是0模3
我是一名优秀的程序员,十分优秀!