Код: Выделить всё
/mnt/d/Users/Lev/adcm/18/ADCM_Connect/PilotWebApplication/PilotWebApplication.csproj : error NU1101: Unable to find package System.Windows. No packages exist with this id in source(s): nuget.org.
Код: Выделить всё
var _xpsDocument = new XpsDocument(stream, FileAccess.Read);
// Create an instance of PdfDocument
PdfDocument pdfDocument = new PdfDocument();
// Use XpsConverter to convert XPS to PDF
XpsConverter.Convert(_xpsDocument, pdfDocument, 0);
// Prepare a stream for writing PDF
var pdfStream = new MemoryStream();
pdfDocument.Save(pdfStream);
pdfStream.Position = 0;
// Set response headers for PDF
Response.Headers.Add("Content-Type", "application/pdf");
var encodedFileName = System.Web.HttpUtility.UrlEncode(fileData.name);
Response.Headers.Add("Content-Disposition", $"attachment; filename=\"{System.IO.Path.ChangeExtension(encodedFileName, ".pdf")}\"");
// Return FileStreamResult with PDF
return new FileStreamResult(pdfStream, "application/pdf");
Вот мои текущие зависимости:
Код: Выделить всё
Exe
net6.0
true
Подробнее здесь: https://stackoverflow.com/questions/781 ... df-c-sharp