0

Apache FOP を使用して PDF を生成しています。私のデータは XML ファイルにあり、XSL スタイルシートを使用してレンダリングしています。スタイルシートで SVG を使用できません。私はSVGを作成しました

<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="400" height="400" id="svg2">
<path d="M200,200  L390,200  A190,190 0 0,1 200,390  z"  fill="red" stroke="black" stroke-width="2"  fill-opacity="0.5" stroke-linejoin="round" />
<path d="M200,200  L200,390  A190,190 0 0,1 10,200  z"  fill="orange" stroke="black" stroke-width="2"  fill-opacity="0.5" stroke-linejoin="round" />
<path d="M200,200  L10,200  A190,190 0 0,1 200,10  z"  fill="yellow" stroke="black" stroke-width="2"  fill-opacity="0.5" stroke-linejoin="round" />
<path d="M200,200  L200,10  A190,190 0 0,1 390,200  z"  fill="green" stroke="black" stroke-width="2"  fill-opacity="0.5" stroke-linejoin="round" />
</svg>

しかし、どうすればスタイルシートに入れることができますか。いいねで入れてみ<fo:instream-foreign-object>

<fo:instream-foreign-object  xmlns:svg="http://www.w3.org/2000/svg">
    <svg:svg width="400" height="400">
    <svg:path d="M200,200  L390,200  A190,190 0 0,1 200,390  z"  fill="red" stroke="black" stroke-width="2"  fill-opacity="0.5" stroke-linejoin="round" />
...
    </svg:svg>
</fo:instream-foreign-object>

しかし、これはうまくいきません。私が間違っていることを誰かが知っていますか?

4

2 に答える 2

0

彼は、文字サイズの背景として FOP 内の SVG の私の例です (テキスト「背景領域」を使用):

  <fo:block-container absolute-position="absolute"
        top="0in" left="0in" width="8.5in" height="11in"
        content-height="scale-to-fit"  content-width="scale-to-fit" 
        scaling="non-uniform"
        background-position="center"  background-repeat="no-repeat"
        background-image="url(your_xml_file.svg)">
    <fo:block>background region
    </fo:block>
  </fo:block-container>
于 2013-07-12T19:13:52.780 に答える
0

私はそれをすべて間違っていたことが判明しました。それを行う正しい方法は、行うのではなく

<svg:path stroke="black" stroke-width="2"  fill-opacity="0.5" stroke-linejoin="round" />

このようにパスを描く必要があります

<svg:path stroke="black" stroke-width="2"  fill-opacity="0.5" stroke-linejoin="round">
    <xsl:attribute name="fill">red</xsl:attribute>
    <xsl:attribute name="d">M200,200  L390,200  A190,190 0 0,1 200,390  z</xsl:attribute>
</svg:path>
于 2013-07-15T10:36:27.230 に答える