perf: Optimize pdf generation performance by reducing file I/O by filzrev · Pull Request #10461 · dotnet/docfx

This PR intended to optimize PDF generation performance.

On current implementation.

1 . PrintHeaderFooterCore method is called every page numbers. And it access physical every times.
2. When header/footer is specified as string. It process try-catch operation every times.

What's changed in this PR

  1. Add InvalidPathChars checks to detect pdfHeaderTemplate/pdfFooterTemplate is HTML content or not.
  2. Add headerFooterTemplateCache to reduce file I/O.
  3. Rename headerFooterCache to headerFooterPageCache