Skip to content

Commit 6a0bdf1

Browse files
kblokMeir017
authored andcommitted
Add 'PreferCSSPageSize' to PdfOptions (#634)
1 parent 6ee54f5 commit 6a0bdf1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/PuppeteerSharp/Page.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,8 @@ public async Task<byte[]> PdfDataAsync(PdfOptions options)
879879
marginBottom,
880880
marginLeft,
881881
marginRight,
882-
pageRanges = options.PageRanges
882+
pageRanges = options.PageRanges,
883+
preferCSSPageSize = options.PreferCSSPageSize
883884
}).ConfigureAwait(false);
884885

885886
var buffer = Convert.FromBase64String(result.GetValue("data").Value<string>());

lib/PuppeteerSharp/PdfOptions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,11 @@ public class PdfOptions
7171
/// Paper margins, defaults to none
7272
/// </summary>
7373
public MarginOptions MarginOptions { get; set; } = new MarginOptions();
74+
75+
/// <summary>
76+
/// Give any CSS <c>@page</c> size declared in the page priority over what is declared in <c>width</c> and <c>height</c> or <c>format</c> options.
77+
/// Defaults to <c>false</c>, which will scale the content to fit the paper size.
78+
/// </summary>
79+
public bool PreferCSSPageSize { get; set; }
7480
}
7581
}

0 commit comments

Comments
 (0)