Has anybody used NFOP?

Soldato
Joined
8 Jan 2003
Posts
3,807
Location
Scotland
I've managed to get it to take an XML file and an XSL file, create an FO file and then ultimately output a PDF file.

What I'm now trying to do is output the stream to the user browser as opposed to a file.

Any ideas?

Code:
Imports System.Xml
Imports System.Xml.xsl
Imports System.Xml.XPath
Imports org.apache.fop
Imports org.apache.fop.apps
Imports org.apache.fop.tools
Imports org.xml.sax
Imports java.io

Partial Class _Default
    Inherits System.Web.UI.Page


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        'load the xsl stylesheet
        Dim xslt As XslCompiledTransform = New XslCompiledTransform
        xslt.Load(Server.MapPath("./jobapplicationformfo.xsl"))
        'execute the transform and output the results to a FO file
        xslt.Transform(Server.MapPath("./employmentapplicationTest01.xml"), Server.MapPath("./app.fo"))

        GeneratePDF(Server.MapPath("./app.fo"), Server.MapPath("./application.pdf"))
        Response.Write("PDF Generated")
    End Sub

    Private Sub GeneratePDF(ByVal foFile As String, ByVal pdfFile As String)
        Dim streamFO As FileInputStream = New FileInputStream(foFile)
        Dim src As InputSource = New InputSource(streamFO)
        Dim streamOut As FileOutputStream = New FileOutputStream(pdfFile)
        Dim driver As Driver = New Driver(src, streamOut)
        driver.setRenderer(1)
        driver.run()
        streamOut.close()
    End Sub
 
Back
Top Bottom