Files
BeWoPlaner/Service/ServiceImplementations/ApiStreamServiceImp.cs
Rene Evertz 2832bb9c5e Merge branch 'master' into feature_rene_18_ai - kein kommentar...
# Conflicts:
#	BeWo/BeWo.csproj
#	BeWo/BeWoApp.xaml.cs
#	BeWo/ServiceProxy/GeneratedAiEnhancedService.cs
#	BeWo/Services/BeWoControlFactory.cs
#	BeWo/Services/BeWoWindowFactory.cs
#	BeWo/Services/BeWoWindowService.cs
#	BeWo/Services/IControlFactory.cs
#	BeWo/Services/IWindowFactory.cs
#	BeWo/Services/IWindowService.cs
#	BeWo/View/BeWoFileView.xaml
#	BeWo/View/Detail/Report/AbwesenheitsView.xaml
#	BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs
#	BeWo/app.config
#	BeWoAllReports.sln
#	BeWoPlanerMobil.sln
#	BeWoPlanerMobil/.vs/BeWoPlanerMobil.csproj.dtbcache.json
#	BeWoTests.sln
#	Dakota/DakotaUtils.cs
#	Dakota/Logic/DakotaInfoCreator.cs
#	Dakota/Models/DakotaFile.cs
#	Data/Access/GenericDAO.cs
#	Data/Access/SearchDAO.cs
#	Data/Data.csproj
#	Host/Web.config
#	Server/Components/ServerUtils/ApiFacade/WebClientFacade.cs
#	Service/BeWoServiceEnums.cs
#	Service/Core/ServiceHelper.cs
#	Service/Core/ServiceValidator.cs
#	Service/Extensions/ServiceEnumExtension.cs
#	Service/Service.csproj
#	Service/ServiceContracts/Enhanced/IAiEnhancedService.cs
#	Service/ServiceContracts/Enhanced/IOperationsEnhancedService.cs
#	Service/ServiceImplementations/EmployeeServiceImp.cs
#	Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs
#	Service/ServiceImplementations/Enhanced/OperationsEnhancedServiceImp.cs
#	Service/ServiceProxy/OpenWebUIFacade.cs
#	Service/ServiceProxy/ServiceFacade.cs
#	Service/ServiceUtils/DistanceCalculator/GoogleDistanceMatrixAPI.cs
#	Shared/BeWoEntityEnums.cs
#	Shared/Core/AppError.cs
#	Shared/Core/Facade/WebClientFacade.cs
#	Shared/Core/WebClientFacade.cs
#	Shared/Shared.csproj
2025-11-28 12:07:35 +01:00

62 lines
1.9 KiB
C#

using BeWo.Data.Access;
using BeWo.Service.Core;
using BeWo.Service.ServiceContracts;
using BS.Shared.Core;
using BS.Shared.DataContracts.AdminService;
using DevExpress.Pdf.Native.BouncyCastle.Ocsp;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceImplementations
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class ApiStreamServiceImp : IApiStreamService
{
//public Stream DownloadReport()
//{
// string filename = "xrechnung.pdf";
// string filePath = Path.Combine(@"C:\Users\ownSoft\Desktop\XRechnung\", filename);
// if (!File.Exists(filePath))
// throw new FileNotFoundException("Datei nicht gefunden");
// // Setze die Header
// WebOperationContext.Current.OutgoingResponse.ContentType = "application/pdf";
// WebOperationContext.Current.OutgoingResponse.Headers.Add(
// "Content-Disposition", $"attachment; filename=\"{filename}\"");
// FileStream f = new FileStream(filePath, FileMode.Open);
// int length = (int)f.Length;
// WebOperationContext.Current.OutgoingResponse.ContentLength = length;
// byte[] buffer = new byte[length];
// int sum = 0;
// int count;
// while ((count = f.Read(buffer, sum, length - sum)) > 0)
// {
// sum += count;
// }
// f.Close();
// return new MemoryStream(buffer);
//}
public Stream GetPdf()
{
WebOperationContext.Current.OutgoingResponse.ContentType = "application/pdf";
WebOperationContext.Current.OutgoingResponse.Headers.Add("Content-Disposition", "inline; filename=\"helloworld.pdf\"");
var lFilePath = MergedConfig.GetSetting(WebConfigSetting.HelloWorldPdfLocation);
return new FileStream(lFilePath, FileMode.Open, FileAccess.Read);
}
public Stream GetPdf2() => GetPdf();
}
}