私はyii2を使用しています。 は、私は(テスト用)、このようなファイルのCSSを持っていると私は、Web/CSSにそれらを置く:load css onこのページを印刷するyii2
body{
font-family: 'Verdana';
font-size: 8px;
}
table{
border : 1px solid black;
}
だから私はこのような_form.phpに登録:
今<?php
$this->registerCssFile("@web/css/struk.css", [
'media' => 'print'
]);
?>
<div class="transaction-form">
..............
、私が持っていますボタン:
Html::button('Test Print', ['class' => 'btn btn-success',
'onclick' => 'w = window.open();'
. 'w.document.write($("#modalContent").html());'
. 'w.print();'
. 'w.close();']),
ただし、CSSが機能していません。 それはとても感謝します。
cssを資産バンドルに登録しよう –