Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 1, 2025

  • Analyze the issue with landscape PDF generation
  • Understand Chrome DevTools Protocol requirements for Page.printToPDF
  • Identify the root cause: paperWidth/paperHeight need to be swapped when landscape=true
  • Implement fix in Browser.cs PrintToPdfAsync method
  • Test the fix with sample code
  • Verify no existing functionality is broken
Original prompt

This section details on the original issue you should resolve

<issue_title>can't generate a landscape pdf with the page settings on a local windows machine with edge</issue_title>
<issue_description>var setting = new PageSettings()
{
Landscape = true,
PaperWidth = 11.69, // A4 横向尺寸 (英寸)
PaperHeight = 8.27
};

using (var converter = new Converter(chromiumExeFileName: null, logger: new ChromiumHtmlToPdfLib.Loggers.Console(), browser: Browser.Edge))
{
converter.WaitForNetworkIdle = true;
converter.EnableChromiumLogging = true;
using (var pdfStream = new MemoryStream())
{
converter.ConvertToPdf(html, pdfStream, setting);
using (FileStream destination = File.Open(fileName, FileMode.OpenOrCreate))
{
pdfStream.Position = 0L;
pdfStream.CopyTo(destination);
}
}
}</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #193

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Sicos1977 Sicos1977 marked this pull request as ready for review October 1, 2025 08:40
@Sicos1977 Sicos1977 merged commit 5929e81 into master Oct 1, 2025
1 check failed
Copilot AI requested a review from Sicos1977 October 1, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't generate a landscape pdf with the page settings on a local windows machine with edge

2 participants