3

PDF出力を提供するxslを設計しています。私のpdf出力は横向きです。シンプルなページマスターを次のように変更しても、横長の出力が得られません。

それでも私のpdf出力の高さは幅よりも大きくなっています。

こんにちはmzjn、私はリンクを持っていません。期待される結果のpdf出力を添付しました結果のpdf - 時計回りに回転 期待される。境界画像の使用方法も知る必要があります。領域本体の背景画像として試行され、失敗しました。

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no"
    indent="yes" />
<xsl:param name="versionParam" select="'1.0'" />
<xsl:template match="@*|node()">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <!-- Start of page layout -->
        <fo:layout-master-set>
            <fo:simple-page-master master-name="A4"
                page-width="8.27in" page-height="11.69in" margin-top="5mm"
                margin-bottom="5mm" margin-left="5mm" margin-right="5mm"
                reference-orientation="90">
                <fo:region-body margin-top=".5cm" margin-bottom=".5cm"
                    margin-left=".5cm" margin-right=".5cm">
                    <xsl:if test="isPreview='true'">
                        <xsl:attribute name="background-image">file:///<xsl:value-of
                            select="pdfimagepath" />Preview Only1.JPG</xsl:attribute>
                    </xsl:if>
                </fo:region-body>
                <fo:region-before extent="0mm" />
                <fo:region-after extent="0mm" />

            </fo:simple-page-master>
        </fo:layout-master-set>
        <!-- End of page layout -->

        <fo:page-sequence master-reference="A4">
            <fo:static-content flow-name="xsl-region-before">
                <fo:block>
                    <fo:leader></fo:leader>
                </fo:block>
                <fo:block text-align="right" font-size="9pt" font-weight="bold">
                    <xsl:value-of select="num" />
                </fo:block>
            </fo:static-content>
            <fo:static-content flow-name="xsl-region-after">
                <fo:block font-size="9pt" font-family="times" text-align="left">

                    <xsl:value-of select="xxx" />
                </fo:block>
            </fo:static-content>

            <fo:flow flow-name="xsl-region-body">
                <fo:block>
                    <fo:table table-layout="fixed" width="100%">
                        <fo:table-header>
                            <fo:table-row>
                                <fo:table-cell>
                                    <fo:block></fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-header>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell width="100%">
                                    <fo:block text-align="center" padding-top="2pt">
                                        <fo:external-graphic content-height="85%"
                                            content-width="65%" scaling="uniform">
                                            <xsl:attribute name="src">
                                <xsl:value-of select="pdfimagepath" />LogoCert.jpg
                                </xsl:attribute>
                                        </fo:external-graphic>
                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell width="100%">
                                    <fo:block text-align="center">
                                        <fo:external-graphic content-height="45%"
                                            content-width="55%" scaling="non-uniform">
                                            <xsl:attribute name="src">
                                    <xsl:value-of select="pdfimagepath" />title.jpg
                                    </xsl:attribute>
                                        </fo:external-graphic>
                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell width="100%">
                                    <fo:block font-size="15.5pt" font-family="Arial"
                                        color="Black" text-align="center" padding-before="5pt"
                                        start-indent="10pt">
                        </fo:block>
                                    <fo:block font-size="15.5pt" font-family="Arial"
                                        color="Black" text-align="center" start-indent="5pt">xxxxxx:
                        </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell width="100%">
                                    <fo:block font-size="16.5pt" font-family="Arial"
                                        color="red" text-align="center" padding-before="8pt">
                                        <xsl:value-of select="custname" />

                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell width="100%">
                                    <fo:block font-size="13.5pt" font-family="Arial"
                                        color="black" text-align="center" padding-before="10pt"
                                        start-indent="10pt">
                                        <fo:inline background-color="yellow">xxxx</fo:inline>xxxx
                                    </fo:block>
                                    <fo:block font-size="13.5pt" font-family="Arial"
                                        color="black" text-align="center" start-indent="10pt"> xxxx
                        </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell padding-start="140pt" padding-end="140pt">
                                    <fo:block font-size="10pt" font-family="Arial" color="black"
                                        text-align="center" border-bottom="solid">
                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell display-align="after"
                                    padding-after="12pt" padding-before="2pt">
                                    <fo:block font-size="15.5pt" font-family="Arial"
                                        color="black" text-align="center"> xxxx
                        </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell padding-start="160pt" padding-end="160pt">
                                    <fo:block font-size="10pt" font-family="Arial" color="black"
                                        text-align="center" border-bottom="solid">
                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>

                            <fo:table-row>
                                <fo:table-cell padding-before="2pt"
                                    display-align="before">
                                    <fo:block font-size="15.5pt" font-family="Arial"
                                        color="black" text-align="center"> 
                                                </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell padding-before="10pt">
                                    <fo:block font-size="8.5pt" font-family="Arial"
                                        color="black" text-align="center"> xxxx
                                                </fo:block>
                                    <fo:block font-size="8.5pt" font-family="Arial"
                                        color="black" text-align="center">
                                                </fo:block>
                                    <fo:block font-size="8.5pt" font-family="Arial"
                                        color="black" text-align="center"> 
                                                </fo:block>
                                    <fo:block font-size="8.5pt" font-family="Arial"
                                        color="black" text-align="center"> 
                                                </fo:block>
                                    <fo:block font-size="8.5pt" font-family="Arial"
                                        color="black" text-align="center">
                                                </fo:block>
                                    <fo:block font-size="8.5pt" font-family="Arial"
                                        color="black" text-align="center"> 
                                                </fo:block>
                                </fo:table-cell>
                            </fo:table-row>

                            <fo:table-row>
                                <fo:table-cell padding-before="5pt"
                                    padding-start="60pt" padding-end="60pt">
                                    <fo:block font-size="20pt" font-family="Arial" color="black"
                                        text-align="center" border-bottom="solid">
                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-body>
                    </fo:table>
                    <fo:table table-layout="fixed" width="100%">
                        <fo:table-column column-width="40%" />
                        <fo:table-column column-width="60%" />
                        <fo:table-header>
                            <fo:table-row>
                                <fo:table-cell>
                                    <fo:block></fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-header>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell padding-before="5pt">
                                    <fo:block font-size="9.5pt" text-align="left"
                                        font-weight="normal">
                                    </fo:block>
                                </fo:table-cell>
                                <fo:table-cell padding-before="5pt">
                                    <fo:block font-size="9.5pt" text-align="center"> 
                                    </fo:block>
                                    <fo:block font-size="9.5pt" text-align="center"
                                        end-indent="10pt"> 
                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-body>
                    </fo:table>
                    <fo:table table-layout="fixed" width="100%">
                        <fo:table-column column-width="50%" />
                        <fo:table-column column-width="50%" />
                        <fo:table-header>
                            <fo:table-row>
                                <fo:table-cell>
                                    <fo:block></fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-header>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell padding-before="5pt"
                                    display-align="after" border="">
                                    <fo:block font-size="10pt" text-align="left"
                                        font-weight="normal">
                                    </fo:block>
                                    <fo:block font-size="13.5pt" text-align="center"
                                        font-weight="normal"> 
                    </fo:block>
                                </fo:table-cell>
                                <fo:table-cell padding-before="5pt"
                                    display-align="after" border="">
                                    <fo:block text-align="center">
                                        <fo:external-graphic content-height="60%"
                                            content-width="40%" scaling="uniform">
                                            <xsl:attribute name="src">
                                <xsl:value-of select="pdfimagepath" />sign.jpg
                                </xsl:attribute>
                                        </fo:external-graphic>
                                    </fo:block>
                                    <fo:block padding-bottom="1pt" font-size="15pt"
                                        text-align="center" font-weight="bold">
                                        _____________________________
                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <fo:table-row>
                                <fo:table-cell display-align="after" border="">
                                    <fo:block font-size="8pt" text-align="left"
                                        font-weight="normal">
                                    </fo:block>
                                </fo:table-cell>
                                <fo:table-cell display-align="after" border=""
                                    padding-before="1pt">
                                    <fo:block font-size="8.5pt" text-align="center"
                                        font-weight="normal">xxxxx
                                </fo:block>
                                    <fo:block font-size="8.5pt" text-align="center"
                                        font-weight="normal">yyyyy
                                </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-body>
                    </fo:table>
                </fo:block>
            </fo:flow>
        </fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>

コードサンプル添付

4

2 に答える 2

1

背景の設定方法がわかりませんが、ページの幅と高さを変更して横向きにする方法を以下に示します。

DITA オープン ツールキットに付属している PDF2 の xsl ファイルを編集しています。ファイル名が同じかどうかはわかりませんが、layout-masters-attr.xsl に以下のコードのチャンクが見つかりました。page-width 変数と page-height 変数を切り替えたことに注意してください。

<xsl-attribute-set name="simple-page-master">
    <xsl-attribute name="page-width">
        <xsl:value-of select="$page-height"/>
    </xsl:attribute>
    <xsl:attribute name="page-height">
        <xsl:value-of select="$page-width"/>
    </xsl:attribute>
</xsl:attribute-set>

これにより、PDF ドキュメント全体が横向きモードに設定されます。また、変数が定義されている場所を見つけて、必要に応じて他の値に変更することもできます。

于 2013-08-20T22:11:15.407 に答える