duannuo4620 2016-04-05 15:16
浏览 33
已采纳

如何在php中打印数据和背景图像?

Hey I am new to php and other stuffs. Now I am trying to make automatic bill creating page. But the problem is the background is not visible in print preview.

When I press the print button on the top left corner of the php page it shows a page without background image, at the same time I don't need print button in the print preview page. If I use <img> tag to insert image I can't able to display datas above the image.

My code

<html>
    <head>
        <title>New Page 1</title>
        <script language="javascript">
        function printpage()
            {
                window.print();
            }
        </script>
    </head>
    <body background="Geekay.jpg">
        <input type="button" value="Print" onclick="printpage();">
        <br><br>
        <br><br>
        <br><br>
        Datas....
    </body>
</html>   
  • 写回答

1条回答 默认 最新

  • dongnao3990 2016-04-08 08:57
    关注

    For printing datas along with background image in print window click more settings (in case of google chrome). Then check background graphics. For not showing print button, I updated my code as given below

    <html>
    <head>
        <title>New Page 1</title>
        <script language="javascript">
        function printpage()
            {
                document.getElementById('print').style.display = 'none';
                window.print();
            }
        </script>
    </head>
    <form name="bill">
    <body background="Geekay1.JPG">
    <div id="print" style="display:block">  
    <input type="button" value="Print" onclick="printpage()">
    </div>
        <br><br>
        <br><br>
        <br><br>
        Datas....
    
    
    
    </body>
    </form>
    </html>   
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 图书信息管理系统程序编写
  • ¥15 7-1 jmu-java-m02-使用二维数组存储多元线性方程组
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题