2008-09-07 9 views
3

winforms에서 webbrowser 컨트롤을 사용하고 있으며 CSS로 적용한 배경 이미지가 인쇄물에 포함되어 있지 않음을 알았습니다.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); 

단지 값을 읽고, 전에 자신이 조정하는 사용자에게 통지 할 수 있습니다이 처리하는 또 다른 방법 : 나는 프로그래밍 방식으로이 일을 원하기 때문에 , 나는이 솔루션을 선택했다 인쇄. 이 레지스트리와의 조정은 좋은 습관이 아니라는 것에 동의해야합니다. 따라서 제안 사항은 공개되어 있습니다. 기본적으로 모든 피드백

답변

1

당신이 가서 중요한 시스템 설정을 변경하려는 경우, 먼저 읽을 수 있는지 확인 현재 설정을 저장하고 완료되면 복원하십시오.

나는 이걸 이라고 생각하는데, 처음에는 연습을하지만, 그렇게해야만한다면 친절 해. 다음은 사용자, 컴퓨터를 사용하는 모든 사람을 혼동 것, 앱이 충돌하면 그런 식으로 (그리고 것입니다) -

Registry.LocalMachine 

또한, LocalUser 대신 LocalMachine의를 변경해보십시오.

0

에 대한

덕분에, 브라우저는 전혀 배경 이미지를 인쇄하지 않습니다. 파이어 폭스에서

IE에서
* File > Page Setup > Check Off "Print Background" 
* File > Print Preview 

* 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) 
1

이 설정에 대한 해당 HKCU 키는 다음과 같습니다 HKEY_CURRENT_USER \ 소프트웨어 \ 마이크로 소프트 \ Internet Explorer를 \ 홈페이지 \ Print_Background

2

또 다른 레지스트리 키는 다음과 같습니다 HKEY_CURRENT_USER \ 소프트웨어 \ 마이크로 소프트 \ Internet Explorer를 \ PAGESETUP \ Print_Background HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Internet Explorer \ PageSetup \ Print_Background

0
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;