1
필자는 fabricjs 캔버스를 인쇄 할 수있는 기능을 만드는 데 몇 주 동안 고생했습니다. 행운을 들이지 않고 mentioned here 메서드를 시도했습니다. 인쇄 대화 상자에 갈 수 있지만 제목과 페이지 정보는 제외하고 비어 있습니다. 누구든지 올바른 방향으로 나를 가리킬 수 있습니까?fabricjs 캔버스를 인쇄 하시겠습니까?
내가 현재 사용하고 있습니다 : 당신은 내용이로드 된 후 인쇄 작업을 할 필요가
// Trying to print
function printCanvas()
{
var dataUrl = document.getElementById('c').toDataURL(); //attempt to save base64 string to server using this var
var windowContent = '<!DOCTYPE html>';
windowContent += '<html>'
windowContent += '<head><title>Print canvas</title></head>';
windowContent += '<body>'
windowContent += '<img src="' + dataUrl + '">';
windowContent += '</body>';
windowContent += '</html>';
var printWin = window.open('','','width=340,height=260');
printWin.document.open();
printWin.document.write(windowContent);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close();
}
<button onclick="printCanvas()">Print</button>
DataURL에서 캡처하는 이미지의 크기를 늘릴 수 있는지 알고 계십니까? 원하는 경우 새로운 질문을 열 수 있습니다. 감사! –
toDataURL()에서 배율을 사용하지 않았습니까? – user700284
내가 말할 수 없었습니다 –