2016-09-23 19 views
0

横向きモードで印刷する必要があるウェブページでレポートを生成しています。横向きのウェブページを印刷

私はこれを数日から探していて、ウェブ上で多くの回答を見つけました。基本的にはシンプルなスタイルが必要です:

@page { 
    size: landscape; 
    margin: 0.5cm 0.5cm 0.5cm 0.5cm; 
} 

しかし、それは私のために働いていないようです。

誰でもお手伝いできますか?

ありがとうございます。

+0

のように試してみるように思えるあなたはさらに、あなたのコンテンツでこれを改善することができますし、styles.Hereこの.SAVE印刷できるサンプルページですすでに回答を持っているには、[こちらのリンクを確認してください](0120)をご覧ください。 –

+0

ありがとうございました。はい、コードは、私が働くと思っていたソリューションを持っていますが、それは私のためにすべての時間働いていません。ブラウザは、コマンドではなくヒントとしての向きを取っているようです。 -webkit-transformを使用すると、-moz-transformも機能しません。ヘッダー(ここのサンプルの最初のdiv - https://www.dropbox.com/s/027765h9am7qh0c/sample.html.zip?dl=0)はすべてのページに表示されなければならず、回転すると正しく表示されません。私は頭の上にあるこの髪の半分を引き出しました。 – Steve

答えて

0

この方法を確認してください。私はこれをChromeとMozilla Firefoxでテストしました。 HTMLページがよりこれら あなたがより多くを参照することができfrom here

<html> 
 

 
<head> 
 
    <style type="text/css"> 
 
    h3 { 
 
     text-align: center; 
 
    } 
 
    
 
    .output { 
 
     height; 
 
     8.5in; 
 
     width: 11in; 
 
     border: 1px solid red; 
 
     position: absolute; 
 
     top: 0px; 
 
     left: 0px; 
 
    } 
 
    @media print { 
 
     .output { 
 
     -ms-transform: rotate(270deg); 
 
     /* IE 9 */ 
 
     -webkit-transform: rotate(270deg); 
 
     /* Chrome, Safari, Opera */ 
 
     transform: rotate(270deg); 
 
     top: 1.5in; 
 
     left: -1in; 
 
     } 
 
    } 
 
    </style> 
 

 
</head> 
 

 
<body> 
 
    <div class="output"> 
 
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 

 
Why do we use it? 
 
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 
 

 

 
Where does it come from? 
 
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. 
 
    </div> 
 
</body> 
 

 
</html>

+0

お返事ありがとうございます。私は、この場合、私はあなたに私がしなければならないことの完全な描写を与えなかったという謝罪をしなければならないと思う。 ヘッダーには「位置」が「固定」に設定されています このレポートは印刷されていると同様に表示されます。 必要な要素とスタイルでサンプルファイルを作成しました。このDropboxのリンクからダウンロードできます - https://www.dropbox.com/s/027765h9am7qh0c/sample.html.zip?dl=0 ボックスが重複していることがわかります – Steve

+0

申し訳ありません、以前のコメントは正しく入ってこない。私はここで最初のタイマーです。 :-) 下記に別のコメントを追加しています。 – Steve

+0

返信いただきありがとうございます。私はあなたに、私が必要とするものの完全な描写をしていないという謝罪をしています。 2x2,3x3などのマトリックスで画像を表示して印刷するレポートです。 必要な要素とスタイルでサンプルファイルを作成しました。 dropbox link - https://www.dropbox.com/s/027765h9am7qh0c/sample.html.zip?dl=0 トップdivからクラスを削除し、印刷プレビューを使用して必要な結果を確認することができます。 ヘッダーには「位置」=「固定」があり、すべてのページに印刷されます。 赤い枠線の枠は画像が表示される場所です。ヘッダーを含むコンテンツのオーバーラップは、パディングトップによって処理されます。 – Steve

関連する問題