static void Jinn_GeneralSSRSPDFByCode(Args _args) { System.Net.WebRequest request; System.Net.WebResponse response; System.IO.Stream stream; System.IO.FileStream fileStream; System.Byte[] buffer = new System.Byte[1024](); str m_URL = @"http://******/ReportServer/Pages/ReportViewer.aspx?%2fDynamics %2fCustSalesOrderReportSRS.CustSalesConfirmSRS.RDS&rs:Command=Render&rs:Format=pdf"; str m_FileName = @"\\****\MailAttachment\SalesConfirmation.pdf"; int m_ByteRead; ; request = System.Net.WebRequest::Create(m_URL); request.set_Credentials(System.Net.CredentialCache::get_DefaultNetworkCredentials()); response = request.GetResponse(); stream = response.GetResponseStream(); fileStream = new System.IO.FileStream(m_FileName, System.IO.FileMode::Create); m_ByteRead = stream.Read(buffer, 0, buffer.get_Length()); while (m_ByteRead) { fileStream.Write(buffer, 0, m_ByteRead); m_ByteRead = stream.Read(buffer, 0, buffer.get_Length()); } fileStream.Close(); }
时间: 2024-10-29 05:06:45