- Code: Select all
public async Task<FileModel> ConvertDocToPdfAsync(IFormFile file, string resultFileName)
{
Document document = new();
using (Stream stream = file.OpenReadStream())
using (MemoryStream targetStream = new())
{
document.LoadFromStream(stream, Spire.Doc.FileFormat.Auto);
document.SaveToStream(stream, Spire.Doc.FileFormat.PDF); // error
return FileModel.Build(resultFileName, targetStream.ToArray());
}
}
"Message": "Specified method is not supported.",
"Data": null,
"InnerException": {
"$type": "System.NotSupportedException, System.Private.CoreLib",
"ClassName": "System.NotSupportedException",
"Message": "Specified method is not supported.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at Microsoft.AspNetCore.Http.ReferenceReadStream.Write(Byte[] buffer, Int32 offset, Int32 count)\r\n at System.IO.Stream.WriteByte(Byte value)\r\n at spr㚳.ᜂ(String A_0)\r\n at spr㚏.ᜅ(Stream A_0, spr㚞 A_1, Boolean A_2)\r\n