W
Will Rickards
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.HtmlTextWriter)
' create stream to store output
Dim objRendered As System.web.UI.HtmlTextWriter
Dim objFileWriter As System.IO.StreamWriter
' get file writer
objFileWriter = System.IO.File.CreateText(Server.MapPath(".") &
"\\PDF\\" & CStr(m_intReportNumber) & ".xhtml")
objRendered = New System.Web.UI.HtmlTextWriter(objFileWriter)
MyBase.Render(objRendered)
objFileWriter.Flush()
objFileWriter.Close()
objRendered.Flush()
objRendered.Close()
writer.Write("Done")
End Sub
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.HtmlTextWriter)
' create stream to store output
Dim objRendered As System.web.UI.HtmlTextWriter
Dim objFileWriter As System.IO.StreamWriter
' get file writer
objFileWriter = System.IO.File.CreateText(Server.MapPath(".") &
"\\PDF\\" & CStr(m_intReportNumber) & ".xhtml")
objRendered = New System.Web.UI.HtmlTextWriter(objFileWriter)
MyBase.Render(objRendered)
objFileWriter.Flush()
objFileWriter.Close()
objRendered.Flush()
objRendered.Close()
writer.Write("Done")
End Sub