Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# MSHTML打印时出现断页_C#_Html_Css_.net - Fatal编程技术网

C# MSHTML打印时出现断页

C# MSHTML打印时出现断页,c#,html,css,.net,C#,Html,Css,.net,我在使用mshtml.dll打印html页面时遇到问题。我的页面包含指向引导css的链接。在浏览器中(即,FF,Chrome),所有的外观都很好,打印也很好。当我试图用MSHTML打印页面时,出现了一些问题,页面看起来好像css不起作用。我正在从磁盘加载html内容,然后打印它: var htmlContent = File.ReadAllText(filePath); var htmlDocument = new HTMLDocument() as IHTMLDocument2; htmlDo

我在使用
mshtml.dll
打印html页面时遇到问题。我的页面包含指向
引导css
的链接。在浏览器中(即,FF,Chrome),所有的外观都很好,打印也很好。当我试图用
MSHTML
打印页面时,出现了一些问题,页面看起来好像
css
不起作用。我正在从磁盘加载html内容,然后打印它:

var htmlContent = File.ReadAllText(filePath);
var htmlDocument = new HTMLDocument() as IHTMLDocument2;
htmlDocument.write(htmlContent);

htmlDocument.execCommand("Print", true, 0);

htmlDocument.styleSheets; // contains all linked css files
有人遇到过这样的问题吗?也许还有其他方法可以在不使用浏览器的情况下打印html页面