xf 3 meses atrás
pai
commit
7de4fd7f60

+ 2 - 2
src/Hotline.Api/Controllers/KnowledgeController.cs

@@ -749,7 +749,7 @@ namespace Hotline.Api.Controllers
             }
 
             var info = await _knowledgeRepository.GetAsync(dto.Ids[0]) ?? throw UserFriendlyException.SameMessage("知识不存在");
-            return info.Content.HtmlToStream(dto.FileType).GetFileStreamResult(dto.FileType, info.Title, false);
+            return info.Content.HtmlToStream(dto.FileType, info.Title, _pdfManager).GetFileStreamResult(dto.FileType, info.Title, false);
         }
 
         /// <summary>
@@ -846,7 +846,7 @@ namespace Hotline.Api.Controllers
             //return _baseDataApplication
             //    .FileType(EFileType.excel | EFileType.pdf)
             //    .Build();
-            var ignoreFileType = EFileType.excel ;//| EFileType.pdf;
+            var ignoreFileType = EFileType.excel;//| EFileType.pdf;
             var items = EnumExts.GetDescriptions<EFileType>();
             var filteredDictionary = items
                  .Where(kvp => (ignoreFileType & (EFileType)kvp.Key) == 0)

+ 6 - 1
src/Hotline.Application/Tools/StringExtensions.cs

@@ -1,4 +1,5 @@
-using Hotline.Application.ExportWord;
+using System.Text;
+using Hotline.Application.ExportWord;
 using Hotline.Pdf;
 using Hotline.Share.Enums.Article;
 using XF.Domain.Exceptions;
@@ -28,6 +29,10 @@ public static class StringExtensions
                 .Replace("&lt;", "<")
             ;
 
+        //去除html标签
+        var sb = new StringBuilder();
+
+
         var stream = new MemoryStream();
         pdfManager.GeneratePdf(title, content, stream);
         stream.Seek(0, SeekOrigin.Begin);