Closed cjlotz closed 6 months ago
I've confirmed it can change page size and orientation with following steps.
1. Set PagePdfOptions's PreferCSSPageSize
property to true
.
https://github.com/dotnet/docfx/blob/464b947169eee016e4ca166cbae3f6a82f6178eb/src/Docfx.App/PdfBuilder.cs#L169 See: https://playwright.dev/docs/api/class-page#page-pdf-option-prefer-css-page-size
2. Add print style at custom template's main.css
file.
@media print {
@page {
size: A3 landscape
}
}
Make sense to me to set PreferCSSPageSize
to true
.
How difficult will it be to extend to the existing PDF printing logic to specify the orientation and page size of the page that should be used? Thinking of adding
pdfOrientation: landscape | portrait
setting. If not specified it should default toportrait
. For size, using something likepdfPageSize: A0 | A1 .. | Letter
If possible, any pointers where to start looking at adding the support to the existing code base?