简体   繁体   English

在同一张照片上打印横向div和纵向div

[英]Print a div in landscape and a div in portrait on a same print

I would like to know if it's possible to print some part of a web page in landscape and other part in portrait.If yes, how? 我想知道是否可以横向打印网页的某些部分并以纵向打印其他部分,如果可以,如何打印?

More details: I'm currently doing a web page where we can found an image (in a div) and a table(in an another div). 更多详细信息:我目前正在做一个网页,在这里可以找到图像(在div中)和表(在另一个div中)。 The image is on a page and the table on an other page. 该图像在一页上,而表格在另一页上。 Sometimes my image need to be printed in landscape. 有时我的图像需要横向打印。 The table is always in portrait. 桌子始终是纵向的。 So what I did for the moment is: ` $distanceY) { ?> 因此,我目前所做的是:`$ distanceY){?>

                        <div  id="plancompletpaysage" class="impression-paysage">
                            <?php
                            echo '<img src="plan.php?restaurant=' . $_POST['restaurant'] . '&seance=' . $_POST['seance'] . '&date=' . $_POST['date'] . '&heure=' . $_POST['heure'] . '"  usemap="places" />';
                            ?>
                        </div>
                        <?php
                    }
                    if ($distanceX < $distanceY) {
                        ?>                   
                        <div  id="plancompletportrait" class="impression-portrait">
                            <?php
                            echo '<img src="plan.php?restaurant=' . $_POST['restaurant'] . '&seance=' . $_POST['seance'] . '&date=' . $_POST['date'] . '&heure=' . $_POST['heure'] . '"  usemap="places" />';
                            ?>
                        </div>
                        <?php
                    }
                    ?>`

I try that: 我尝试:

<style>
 @media print{
            @page paysage{
                size: landscape;
            }

            .impression-paysage{
                page: paysage;
            }

        }  
</style>

Using that change nothing. 使用该更改没有任何效果。 Everything stay in portrait. 一切都保持肖像。

Thank you for your help. 谢谢您的帮助。

EDIT: This is the solution I find with the help @Mordecai : 编辑:这是我在@Mordecai帮助下找到的解决方案:

                .impression-paysage{

                display: block;
                margin-top:120px;

                margin-left:-100px;
                text-align:center;
                width:140%;
                height:160%;
                transform: rotate(-90deg);
                zoom: 150% ;

            }

So 1st step: resize the div. 因此,第一步:调整div的大小。 The 2nd step: rotation of the div. 第二步:旋转div。

Page printing layout is portrait by default. 页面打印布局默认为纵向。

To print div .impression-paysage in landscape orientation, you can use transform:rotate(90deg) or transform:rotate(-90deg) . 要以横向打印div .impression-paysage ,可以使用transform:rotate(90deg)transform:rotate(-90deg)

@media print {
  .impression-paysage {
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM