문제

내가 사용하는 웹 브라우저 제어에 winforms 고 지금 발견하는 배경 이미지는 내가 적용 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);

를 처리하는 다른 방법이 될 수 있습 값을 읽고 사용자에게 통지하는 조정이 자기를 인쇄합니다.나는 것을 합의한 조정하는 레지스트리와 같은 이가는 것이 좋습니다되지 않습니다,그래서 내가 열어에 대한 모든 좋은 장소를 제공합니다.

귀하의 모든 의견을 주셔서 감사

도움이 되었습니까?

해결책

만약 당신이 갈고 변경의 중요한 시스템을 설정하는지 확인을 먼저 읽 현재 설정을 복원할 때 당신은 할 수 있습니다.

매우 나쁘 연습에서는 첫 번째 장소,하지만 당신이해야 할 그런 다음출할 수 있습니다.

Registry.LocalMachine

또한을 변경하십시오 LocalUserLocalMachine -는 방법으면 앱(고),그 다음 당신은 혼동하는 것이 아니라 사용자는 모든 사람 사용하는 기계입니다.

다른 팁

다른 레지스트리 키가 될 것이다:HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\Print_Background HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\PageSetup\Print_Background

해당하는 마이크로 키에 대한 이 설정은 다음과 같습니다.HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Print_Background

기본적으로,브라우저하지 않는 배경 이미지를 인쇄합니다.

Firefox

* File > Page Setup > Check Off "Print Background"
* File > Print Preview

IE

* Tools > Internet Options > Advanced > Printing
* Check Off "Print Background Images and Colors"

에 오페라

* File > Print Options > Check Off "Print Page Background"
* File > Print Preview (You may have to scroll down/up to see it refresh)
var sh = new ActiveXObject("WScript.Shell");
key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Print_Background";
var defaultValue = sh.RegRead(key); 
sh.RegWrite(key,"yes","REG_SZ");
document.frames['detailFrame'].focus(); 
document.frames['detailFrame'].print();
sh.RegWrite(key,defaultValue,"REG_SZ");  
return false; 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top