Ok, so I'm rendering a partial view control in memory that generates HTML that I would like to get to a PDF renderer. The renderer only takes a string as an argument. I have a MemoryStream containing the HTML that I need to get to the renderer.
This is what I'd like to do:
- inStream is the MemoryStream of HTML from the partial view.
- doc is an instance of the PDF renderer that accepts HTML as an argument but only as a string.
var stream = new StreamReader(inStream);
var html = stream.ReadToEnd();
doc.AddHtml(html);
The problem is that the html string has escape characters everywhere that destroy the HTML.
(image no longer available)
I'm experimenting right now with different solutions and products in order to generate PDFs from my web app. I had an XSL-F开发者_Python百科O to PDF renderer set up that accepted a Stream as an argument and that was working just fine. If there is no way to do this then I will just look for another solution. I'm just curious if it's possible.
Thanks!
The string does not contain the backslashes. Only the debugger is showing them. The intention was to make the representation valid C# syntax for a literal string. It is a bit confusing, admittedly.
精彩评论