2

I know several people asked questions like this, but no answer helped to solve my problem.

Well, I have xsl and xml and want to generate pdf with a processor like Apache.FOP. I am not able to use any JAVA programms like that. Just able to use C# libraries / exe.

I tried to use nFop:

  • Version 1.x uses Java.io and..
  • Version 2.0 doesn't have the ability to set XsltSettings

My current Software uses XSL + XML -> HTML (using standard Stystm.Xml.Xsl on C#) and wktmltopdf to generate PDF from created HTML. But tables got split when they are too long for the page, and on the next page you don't have any column headers (this is very important for my problem).

I think there are no Free FO-Processor for pure C

1 Answers1

0

Have a look at 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);
}
jBravo
  • 873
  • 1
  • 9
  • 28