I am developing a customized delivery extension and I am trying to
write the stream renderedoutputfile[] to a file on the server. When I
write it to a file, the file is blank with a bunch of spaces in it. Do
I need to decode the Stream? Any help would be great.
Here is the code I am using.
This is inside the Delivery Method..
deviceInfo = String.Format(@."<DeviceInfo><OutputFormat>{0}</OutputFormat></DeviceInfo>","PDF");
// Render report
files = notification.Report.Render("PDF",deviceInfo);
BinaryReader br = new BinaryReader(m_files[0].Data);
byte[] byteData = new byte[(int)m_files[0].Data.Length];
int j = br.Read(byteData,0, (int)m_files[0].Data.Length);
FileStream fst = new FileStream(@."c:\temp\test.pdf", FileMode.Append,
FileAccess.Write);
BinaryWriter writer = new BinaryWriter(fst);
writer.Write(byteData,0,byteData.Length);
writer.Flush();
writer.Close();
What I am doing wrong? Code is in c#.Is it as simple as:
files = notification.Report.Render("PDF",deviceInfo);
=> note you're writing to local variable files
BinaryReader br = new BinaryReader(m_files[0].Data);
=> note you're reading from member variable m_files
-Lukasz
This posting is provided "AS IS" with no warranties, and confers no rights.
"jason" <obryan7@.hotmail.com> wrote in message
news:d16403e7.0407180926.620e1a79@.posting.google.com...
> I am developing a customized delivery extension and I am trying to
> write the stream renderedoutputfile[] to a file on the server. When I
> write it to a file, the file is blank with a bunch of spaces in it. Do
> I need to decode the Stream? Any help would be great.
> Here is the code I am using.
> This is inside the Delivery Method..
> deviceInfo =String.Format(@."<DeviceInfo><OutputFormat>{0}</OutputFormat></DeviceInfo>","
PDF");
> // Render report
> files = notification.Report.Render("PDF",deviceInfo);
> BinaryReader br = new BinaryReader(m_files[0].Data);
> byte[] byteData = new byte[(int)m_files[0].Data.Length];
> int j = br.Read(byteData,0, (int)m_files[0].Data.Length);
> FileStream fst = new FileStream(@."c:\temp\test.pdf", FileMode.Append,
> FileAccess.Write);
> BinaryWriter writer = new BinaryWriter(fst);
> writer.Write(byteData,0,byteData.Length);
> writer.Flush();
> writer.Close();
> What I am doing wrong? Code is in c#.
Tuesday, March 27, 2012
Customized Delivery Extension
Labels:
customized,
database,
delivery,
developing,
extension,
file,
microsoft,
mysql,
oracle,
renderedoutputfile,
server,
sql,
stream,
write
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment