playwright-dotnet: Error when generating pdf

When trying to generate a pdf after updating to latest nuget package (0.111.2), I receive the following error: PlaywrightSharpException: options.format.toLowerCase is not a function

after calling it like this:

var result = await page.GetPdfAsync(null, pdfConversionOptions.Scale, pdfConversionOptions.DisplayHeaderFooter, pdfConversionOptions.HeaderTemplate, pdfConversionOptions.FooterTemplate,
  pdfConversionOptions.PrintBackground, pdfConversionOptions.Landscape, pdfConversionOptions.PageRanges, pdfConversionOptions.Format, pdfConversionOptions.Width, pdfConversionOptions.Height,
  pdfConversionOptions.Margin, pdfConversionOptions.PreferCSSPageSize);

I tried also specifying directly PaperFormat.Letter for example but I receive the same error…

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Yeah no problem simply run the app, I edited the home page index endpoint, so it is generating the pdf file by default (see HomeController.cs -> Index endpoint on line 23)

Okay for the margins, it’s a css problem I think, so no need to investigate on your side for that, but for the error, I still haven’t figured it out