Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Fonet.标准v1.0.5多页发行版_C#_Xml_Xslt_Apache Fop - Fatal编程技术网

C#Fonet.标准v1.0.5多页发行版

C#Fonet.标准v1.0.5多页发行版,c#,xml,xslt,apache-fop,C#,Xml,Xslt,Apache Fop,因此,我通过nuGet使用Fonet.StandardV1.0.5的样式表(用于测试),如下所示。它生成一个PDF,当的内容适合不到一个页面时,一切都很好。但当内容溢出时,PDF中只生成第一页,但页脚正确地指示应该有多页,即第1页,共2页。在非Windows环境中,ApacheFOP也可以使用相同的结构。那么我应该用不同的方式来处理Fonet.Standard吗?作为参考,用于测试的xml已剥离回 <?xml version="1.0" encoding="U

因此,我通过nuGet使用Fonet.StandardV1.0.5的样式表(用于测试),如下所示。它生成一个PDF,当的内容适合不到一个页面时,一切都很好。但当内容溢出时,PDF中只生成第一页,但页脚正确地指示应该有多页,即第1页,共2页。在非Windows环境中,ApacheFOP也可以使用相同的结构。那么我应该用不同的方式来处理Fonet.Standard吗?作为参考,用于测试的xml已剥离回

<?xml version="1.0" encoding="UTF-8"?>
<Data>
<DateTime>02/06/2021 10:56</DateTime>
</Data>

02/06/2021 10:56
xslt是

<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
         xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">  
  <fo:layout-master-set>
    <fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="18mm" margin-bottom="18mm" margin-left="18mm" margin-right="18mm">
      <fo:region-body margin-top="80mm" margin-bottom="5mm"/>      
      <fo:region-before region-name="header-first"  extent="80mm" />
      <fo:region-after region-name="footer-first" extent="20mm"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="rest" page-height="29.7cm" page-width="21cm" margin-top="18mm" margin-bottom="18mm" margin-left="18mm" margin-right="18mm">
      <fo:region-body  margin-top="25mm"  margin-bottom="5mm"/>
      <fo:region-before region-name="header-rest"  extent="25mm" />
      <fo:region-after region-name="footer-rest" extent="5mm"/>
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="document">
      <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference page-position="first" master-reference="first"/>
        <fo:conditional-page-master-reference page-position="rest" master-reference="rest"/>
      </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="document">
    <fo:static-content flow-name="footer-first">
      <fo:block padding="1pt" text-align="center">
        page <fo:page-number/> of <fo:page-number-citation ref-id="LastPageIndicator"/>
      </fo:block>      
    </fo:static-content>
    <fo:static-content flow-name="footer-rest">
      <fo:block padding="1pt" text-align="center">
        page <fo:page-number/> of <fo:page-number-citation ref-id="LastPageIndicator"/>
      </fo:block>      
    </fo:static-content>
    <fo:static-content flow-name="header-first">
        <fo:block padding="1pt" text-align="center">
            test first header
        </fo:block>      
    </fo:static-content>
    <fo:static-content flow-name="header-rest">
        <fo:block padding="1pt" text-align="center">
            test rest header
        </fo:block>      
    </fo:static-content>    
    <fo:flow flow-name="xsl-region-body">
        <fo:block padding="1pt" text-align="center">
test detai here
        </fo:block>      
        <fo:block id="LastPageIndicator"> </fo:block>
    </fo:flow>
    </fo:page-sequence>
    </fo:root>
    </xsl:template>
</xsl:stylesheet>


第页,共页
第页,共页
测试第一个标题
测试休息头
在这里测试德泰

对不起,请忽略噪音!fonet代码运行良好。Render使用的是memorystream,后来它被转换成Pdf格式,其中有一些代码,从那时起它就应该是一个单独的页面。最终在调试时发现。渲染输出直接到文件而不是流。

检查xsd中的边距、高度和尺寸。它们看起来并不一致。我不知道您用于PDF输出的页面大小,因此我不能推荐更改。在“第一”中输入错误页面高度为29.7cm,看起来很小。页眉为80毫米(0.8厘米),页脚为20毫米(0.2厘米)。是的,29.7厘米为A4高度,80毫米=8厘米。20毫米=2厘米。。。所有的xslt看起来都很好。像这样将region name属性添加到fo:region主体中有帮助吗?