https://msdn.microsoft.com/en-us/library/ms252172.aspx
I am using the render method from that article
public void Render(
string format,
string deviceInfo,
CreateStreamCallback createStream,
out Warning[] warnings
)
The render method calls the CreateStream
private Stream CreateStream(string name, string fileNameExtension,
Encoding encoding, string mimeType, bool willSeek)
{
Stream stream = new FileStream(name + "." + fileNameExtension,
FileMode.Create);
m_streams.Add(stream);
return stream;
}
m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream, out warnings);
foreach (Stream stream in m_streams)
stream.Position = 0;
If i want the CreateStream method to write a http response object using chunk's how can i achieve it ?
what does the foreach method do here apart from iteration why does it set the stream.Position to 0 ?
Since the report.Render method returns a void and makes a callback to CreateStram and if the image is huge how do i loop over the chunks and return the binary chunks to http response object ?
You can do anything with the results from RenderStream
as byte[], right. I don't know why the position is set to 0 above however, you could write the image to a temp folder, for example:
var image = _service.RenderStream("HTML4.0", streamID, null, out imageEncoding, out mimeType);
File.WriteAllBytes(Path.Combine(_physicalTempFolder,streamID),image);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.