fix(chromium): better singlePage handling - accounting for margins now

This commit is contained in:
Julien Neuhart
2026-03-27 19:50:20 +01:00
parent bb91259829
commit 40d75882a2

View File

@@ -31,7 +31,9 @@ func printToPdfActionFunc(logger *slog.Logger, outputPath string, options PdfOpt
// There are 96 CSS pixels per inch.
// See https://issues.chromium.org/issues/40267771#comment14.
paperHeight = cssContentSize.Height / 96
// We add top and bottom margins so that the content area
// is large enough to fit the entire content.
paperHeight = (cssContentSize.Height / 96) + options.MarginTop + options.MarginBottom
pageRanges = "1" // little dirty hack to avoid leftovers.
}