2

我知道有几个人问过这样的问题,但没有答案有助于解决我的问题。

好吧,我已经xsl并且xml想要pdf使用像 Apache.FOP 这样的处理器来生成。我无法使用任何JAVA这样的程序。只能使用 C# 库/exe。

我尝试使用nFop

  • 版本 1.x 使用 Java.io 和..
  • 2.0 版无法设置 XsltSettings

我当前的软件使用XSL + XML -> HTML(使用Stystm.Xml.XslC# 上的标准)并 从 createdwktmltopdf生成。但是当表格对于页面来说太长时,表格会被拆分,并且在下一页上您没有任何列标题(这对我的问题非常重要)。PDFHTML

我认为纯 C 没有免费的 FO 处理器

4

1 回答 1

0

看看FoNET

public static bool XMLToPDF(string pXmlFile, string pXslFile, string pFoFile, string pPdfFile)
{
    string lBaseDir = System.IO.Path.GetDirectoryName(pXslFile);
    XslCompiledTransform lXslt = new XslCompiledTransform();
    lXslt.Load(pXslFile);
    lXslt.Transform(pXmlFile, pFoFile);
    FileStream lFileInputStreamFo = new FileStream(pFoFile, FileMode.Open);
    FileStream lFileOutputStreamPDF = new FileStream(pPdfFile, FileMode.Create);
    FonetDriver lDriver = FonetDriver.Make();
    lDriver.BaseDirectory = new DirectoryInfo(lBaseDir);
    lDriver.CloseOnExit = true;
    lDriver.Render(lFileInputStreamFo, lFileOutputStreamPDF);
    lFileInputStreamFo.Close();
    lFileOutputStreamPDF.Close();
    return System.IO.File.Exists(pPdfFile);
}
于 2016-08-02T06:42:12.837 回答