iframe 내에서 Google지도 API v3지도가 포함 된 페이지를 인쇄하고 있습니다. iframe을 인쇄하기 전에 페이지가 완전히로드되었는지 확인하기 위해 다음 코드를 구현했습니다. 심지어 document.readystate === 'complete'
후 500 밀리 초 지연에Document.readystate가로드중인 Google지도 캔버스 이미지에 대해 거짓말입니다
/**
* Auto print the page once the full document has finished loading
*/
function checkDocumentStateChange(documentElement) {
var document = documentElement;
console.log('Document ReadyState: ' + document.readyState);
document.onreadystatechange = function() {
console.log('Document ReadyState: ' + document.readyState);
if (document.readyState === 'complete') {
console.log("Document fully loaded!");
console.log("Printing report from within iframe");
setTimeout(function() {
window.print();
var requestOrigin = '@viewModel.RequestOrigin';
if(!!requestOrigin) {
// Tell the parent window that the print has occurred, so it can prepare to cleanup and remove this iframe
console.log("Send postMessage: secret");
parent.postMessage('secret', requestOrigin);
}
}, 500);
}
}
} 그러나
은, 아니 이미지 빈/회색 구글지도 캔버스와 종종 페이지 인쇄, 사실이다.
페이지를 다시로드하지 않고 window.print()를 다시 실행하면 예상대로 모든 맵 이미지가있는 iframe이 인쇄됩니다. 문서 준비 상태가 거짓말입니다.
나는 지연을 증가 외에이 문제를 해결하기 위해 할 수있는 일 더 오래
gmaps는 iframe을 제어하면 콘텐츠 로딩은 readyState가 – dandavis
에 영향을주지 않습니다 당신은에 CORS 헤더를 설정할 수있는 콘텐츠를 추가합니다. –
@dandavis thats 내가 생각한 것. – TetraDev