From e27b48c5429fe8d0b8c7d8d966e0d5585135e743 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 9 May 2025 13:50:05 +0800 Subject: [PATCH] Fix problems --- .../Pdf/DocsProjectPdfGeneratorOptions.cs | 20 +++++++++++++++---- .../Docs/Projects/Pdf/ProjectPdfGenerator.cs | 8 ++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/DocsProjectPdfGeneratorOptions.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/DocsProjectPdfGeneratorOptions.cs index 39a7716e68..8ab7bbbbea 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/DocsProjectPdfGeneratorOptions.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/DocsProjectPdfGeneratorOptions.cs @@ -62,16 +62,18 @@ public class DocsProjectPdfGeneratorOptions "; HtmlStyle = @" - body { margin: 20px; line-height: 1.6; font-family: Arial, sans-serif;} - a { text-decoration: none; } + body { margin: 15px; line-height: 1.5; font-family: Arial, sans-serif;} + a { text-decoration: none; word-break: break-all; overflow-wrap: break-word;} + li { word-break: break-all; overflow-wrap: break-word; } .page { page-break-after: always; margin-bottom: 30px; padding: 15px; } img { - max-width:100%; - height: auto; + max-width: 100%; + max-height: 850px; + object-fit: contain; display: block; } code, pre { @@ -97,6 +99,16 @@ public class DocsProjectPdfGeneratorOptions margin: 20px 0; padding: 10px 20px; background: #f8fafc; + } + table { width: 100%; border-collapse: collapse; table-layout: fixed; } + table img { width: 100% !important; height: auto; display: block; } + th { font-weight: bold; background-color: #f5f5f5; } + th, td { + border: 1px solid #333; + padding: 6px 10px; + word-break: break-all; + overflow-wrap: break-word; + width: 100%; }"; CalculatePdfFileName = (project, version, languageCode) => $"{project.ShortName}-{version}-{languageCode}.pdf"; diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/ProjectPdfGenerator.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/ProjectPdfGenerator.cs index 9a29a7776f..943b5d976b 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/ProjectPdfGenerator.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Pdf/ProjectPdfGenerator.cs @@ -184,11 +184,11 @@ public class ProjectPdfGenerator : IProjectPdfGenerator, ITransientDependency if (parentPdfDocument == null) { - AllPdfDocuments.Add(pdfDocument); + AllPdfDocuments.AddIfNotContains(pdfDocument); } else { - parentPdfDocument.Children.Add(pdfDocument); + parentPdfDocument.Children.AddIfNotContains(pdfDocument); } if (navigation.HasChildItems) @@ -214,11 +214,11 @@ public class ProjectPdfGenerator : IProjectPdfGenerator, ITransientDependency { if (parentPdfDocument == null) { - AllPdfDocuments.AddRange(combinations.Value); + AllPdfDocuments.AddIfNotContains(combinations.Value); } else { - parentPdfDocument.Children.AddRange(combinations.Value); + parentPdfDocument.Children.AddIfNotContains(combinations.Value); } } }