diff --git a/docs/index.md b/docs/index.md index ee497ffed05..81da350d038 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,7 +9,7 @@ In this section we will build a simple documentation site on your local machine. > Prerequisites > - Familiarity with the command line > - Install [.NET SDK](https://dotnet.microsoft.com/en-us/download) 8.0 or higher -> - Install [Node.js](https://nodejs.org/) v20 or higher +> - Install [Node.js](https://nodejs.org/) v20 or higher (Optional: It's required when using [Create PDF Files](https://filzrev.github.io/docfx/docs/pdf.html)) Make sure you have [.NET SDK](https://dotnet.microsoft.com/en-us/download) installed, then open a terminal and enter the following command to install the latest docfx: diff --git a/src/Docfx.App/PdfBuilder.cs b/src/Docfx.App/PdfBuilder.cs index 0eefbe13c67..124d39b71d8 100644 --- a/src/Docfx.App/PdfBuilder.cs +++ b/src/Docfx.App/PdfBuilder.cs @@ -48,11 +48,6 @@ class Outline public string? pdfFooterTemplate { get; init; } } - static PdfBuilder() - { - PlaywrightHelper.EnsurePlaywrightNodeJsPath(); - } - public static Task Run(BuildJsonConfig config, string configDirectory, string? outputDirectory = null) { var outputFolder = Path.GetFullPath(Path.Combine( @@ -70,6 +65,8 @@ public static async Task CreatePdf(string outputFolder) if (pdfTocs.Count == 0) return; + PlaywrightHelper.EnsurePlaywrightNodeJsPath(); + Program.Main(["install", "chromium"]); var builder = WebApplication.CreateBuilder();