[英]Print Bootstrap Grid Layout using Custom Styling
我正在使用 Bootstrap Grid 並制作了一個布局。 我想打印與網頁上顯示的完全相同,相同的布局 沒有變化。 我嘗試使用某種使用 javascript 的打印方法來添加自定義 CSS 代碼,但都是徒勞的。
這是我想要打印的完全相同的示例布局 ( Fiddle )。
我嘗試的最后一個打印 JavaScript 代碼是:
<script>
var all_source_content = document.documentElement.innerHTML;
var DocumentContainer = document.getElementById('main_container');
var WindowObject = window.open('', 'PrintWindow', '');
WindowObject.document.writeln('<!DOCTYPE html>');
WindowObject.document.writeln('<html><head><title></title>');
WindowObject.document.writeln('<link rel="stylesheet" href="https://getbootstrap.com/docs/3.3/dist/css/bootstrap.min.css">');
WindowObject.document.writeln('<style></style>');
WindowObject.document.writeln('</head><body>');
console.log(DocumentContainer.innerHTML);
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.writeln('</body></html>');
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
</script>
但它也沒有幫助我。
我想要的布局:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.