duankua3620 2019-03-25 15:31
浏览 195

如何在不改变纸张大小的情况下打印div的内容

I have a php page which dynamically generates ID cards. So I want that when the user clicks a button that id card which is a element gets printed. I tried all the answers available in Stackoverflow but all of them are changing size of the size of the div element whenever i am clicking the print button. Can someone please help me to solve this problem?

Here is my code:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        p{
            font-size: 0.8em;
            padding: 5px 10px 5px 10px;
            margin: 0;
        }
    </style>
</head>
<body>
    <div id="divid" style="border: 1px solid black;width: 30%;height: 250px;">
    <img src="images/logo_small.png" width="150px">
    <img src="images/indane.png" width="150px">
    <img style="float: right;" src="images/zayed.jpg">

    <p style="display: inline-block;"><b>Name:</b>Zayed Ahmed</p>
    <p style="display: inline-block;"><b>Desig:</b>Delivery Man</p>
    <p style="display: inline-block;"><b>DOB:</b>07/09/1974</p>

    <div></div>

    <p style="display: inline-block;"><b>Emp ID:</b> CTPL-01</p>
    <p style="display: inline-block;"><b>PF Code:</b> XXXXXX</p>
    <p style="display: inline-block;"><b>ESI Code:</b> 1234567890</p>

    <div></div>

    <p style="display: inline-block;"><b>Address:</b>53, Alimuddin Street, Kolkata-700016</p>
    <div></div>

    <p style="display: inline-block;"><b>Mobile :</b>93973878873</p>
    <p style="display: inline-block;"><b>Emergency:</b> 9763867657</p>
    <hr>
    <img style="float: left;margin-left: 20px;" src="http://api.qrserver.com/v1/create-qr-code/?data=www.creativett.com&size=50x50">
    <img src="images/sign.png" style="float: right;margin-bottom: 5px;margin-right: 10px;margin-top: 0;">
</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?