In my web application there is an interactive report. Then there need
to be a printable version a pdf. So I found this java tool csstoxslfo
and the java fop tool from apache that will take my xhtml and css and
convert it to pdf.
Problem 1)
I designed the aspx page to produce the xhtml as output. So how do I
save that rendered page to a file on the server? I think it involves
overriding the Render method. I wrote some code which appears below
that I don't know if it will work. Anybody done this before and have
code examples?
Problem 2)
Assuming I can render to a file, I now have to invoke java. I tested
from the command line and this works fine. So now I have to do it from
the asp.net page, wait for it to finish, and then render the resulting
pdf file to the user. I assume all this code will be in the render
override?
Anybody called java before like this?
I'm thinking using a process object and something like the following
for the command. I've been researching and just doing java -jar as the
command doesn't work? Again anybody done this before and have code
examples?
start command /c java -jar thejar.jar options
Will Rickards
Protected Overrides Sub Render(ByVal writer As
System.Web.UI.H tmlTextWriter)
' create stream to store output
Dim objRendered As System.web.UI.H tmlTextWriter
Dim objFileWriter As System.IO.Strea mWriter
' get file writer
objFileWriter = System.IO.File. CreateText(Serv er.MapPath(".") &
"\\PDF\\" & CStr(m_intRepor tNumber) & ".xhtml")
objRendered = New System.Web.UI.H tmlTextWriter(o bjFileWriter)
MyBase.Render(o bjRendered)
objFileWriter.F lush()
objFileWriter.C lose()
objRendered.Flu sh()
objRendered.Clo se()
writer.Write("D one")
End Sub