diff --git a/src/Docfx.App/PdfBuilder.cs b/src/Docfx.App/PdfBuilder.cs index 124d39b71d8..a1c4396f60f 100644 --- a/src/Docfx.App/PdfBuilder.cs +++ b/src/Docfx.App/PdfBuilder.cs @@ -357,6 +357,8 @@ async Task MergePdf() if (!pageBytes.TryGetValue(node, out var bytes)) continue; + var isCoverPage = url.AbsolutePath.TrimStart('/').Equals(outline.pdfCoverPage, GetStringComparison()); + var isTocPage = IsTocPage(url); if (isTocPage) { @@ -375,6 +377,9 @@ async Task MergePdf() var pageBuilder = builder.AddPage(document, i, x => CopyLink(node, x)); + if (isCoverPage) + continue; + if (isTocPage) continue; @@ -615,4 +620,12 @@ static string getMillimeter(double pt) return $"{Math.Round(pt * MillimeterPerInch / Dpi)}mm"; } } + + // Gets StringComparison instance for path string. + private static StringComparison GetStringComparison() + { + return PathUtility.IsPathCaseInsensitive() + ? StringComparison.OrdinalIgnoreCase + : StringComparison.Ordinal; + } }