gpt4 book ai didi

c# - 如何使用 WebBrowser 控件打印 css 应用的背景图像

转载 作者:行者123 更新时间:2023-12-01 01:38:38 24 4
gpt4 key购买 nike

我在 winforms 中使用 webbrowser 控件,现在发现我用 css 应用的背景图像不包含在打印输出中。

有没有办法让网络浏览器也打印显示文档的背景?

编辑:
由于我想以编程方式执行此操作,因此我选择了以下解决方案:

using Microsoft.Win32;

...

RegistryKey regKey = Registry.CurrentUser
.OpenSubKey("Software")
.OpenSubKey("Microsoft")
.OpenSubKey("Internet Explorer")
.OpenSubKey("Main");

//Get the current setting so that we can revert it after printjob
var defaultValue = regKey.GetValue("Print_Background");
regKey.SetValue("Print_Background", "yes");

//Do the printing

//Revert the registry key to the original value
regKey.SetValue("Print_Background", defaultValue);

处理此问题的另一种方法可能是仅读取该值,并在打印前通知用户自己进行调整。我必须同意像这样调整注册表不是一个好习惯,所以我愿意接受任何建议。

感谢您的所有反馈

最佳答案

另一个注册表项是:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\Print_Background
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\PageSetup\Print_Background

关于c# - 如何使用 WebBrowser 控件打印 css 应用的背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com