Docbook 转 FO 转 PDF

前端之家收集整理的这篇文章主要介绍了Docbook 转 FO 转 PDF前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

PDF

sudo apt-get install docbook-xml docbook-xsl xsltproc fop
		

安装字体

sudo mkdir /usr/share/fonts/microsoft
		

将 C:\Windows\Fonts 目录中的字体复制到 /usr/share/fonts/microsoft

$ java -cp /usr/share/java/fop.jar  org.apache.fop.fonts.apps.TTFReader /usr/share/fonts/microsoft/simhei.ttf simhei.xml
$ java -cp /usr/share/java/fop.jar  org.apache.fop.fonts.apps.TTFReader -ttcname "SimSun" /usr/share/fonts/microsoft/simsun.ttc simsun.xml
		
		
sudo vim /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/param.xsl
<xsl:param name="callout.unicode.font">simsun</xsl:param>
<xsl:param name="symbol.font.family">simsun</xsl:param>
<xsl:param name="callout.unicode.font">simsun</xsl:param>
		
		
		 
$ vim fop.conf

<?xml version="1.0"?>
<fop version="1.0">
<base>.</base>

<renderers>
	<renderer mime="application/pdf">
     <filterList>
         <value>flate</value>
     </filterList>
      <fonts>
        <font metrics-url="simhei.xml" kerning="yes" embed-url="/usr/share/fonts/microsoft/simhei.ttf">
          <font-triplet name="simhei" style="normal" weight="normal"/>
          <font-triplet name="simhei" style="normal" weight="bold"/>
          <font-triplet name="simhei" style="italic" weight="normal"/>
          <font-triplet name="simhei" style="italic" weight="bold"/>
          </font>
          <font metrics-url="simsun.xml" kerning="yes" embed-url="/usr/share/fonts/microsoft/simsun.ttc">
          <font-triplet name="simsun" style="normal" weight="normal"/>
          <font-triplet name="simsun" style="normal" weight="bold"/>
          <font-triplet name="simsun" style="italic" weight="normal"/>
          <font-triplet name="simsun" style="italic" weight="bold"/>
          </font>
        </fonts>
    </renderer>
</renderers>
</fop>
		 
		 
xsltproc -o helloworld.fo /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl helloworld.xml
fop -c fop.conf helloworld.fo -pdf helloworld.pdf
		
原文链接:https://www.f2er.com/xml/300628.html

猜你在找的XML相关文章