gpt4 book ai didi

c# - XSL + XML -> 用于 C# 的 PDF

转载 作者:太空宇宙 更新时间:2023-11-03 15:48:49 25 4
gpt4 key购买 nike

我知道有好几个人问过这样的问题,但没有人回答我的问题。

嗯,我有xslxml并想要生成 pdf使用像 Apache.FOP 这样的处理器。我无法使用任何 JAVA程序之类的。只能使用 C# 库/exe。

我尝试使用 nFop :

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

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

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

最佳答案

看看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);
}

关于c# - XSL + XML -> 用于 C# 的 PDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26887432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com