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>   
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器