如何使用php下载/打印页面的特定部分 [英] How to download/print specific portion of a page using php

查看:47
本文介绍了如何使用php下载/打印页面的特定部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML页面如下

I have an HTML page as follows

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.
<table>
    <th>WEEK</th>
    <th>DATES</th>
    <th>Workout #1</th>
    <th>Workout #2</th>
    <th>Workout #3</th>
    <tr>
        <td>1</td>
        <td>3/27-4/2</td>
        <td>Warm up for 5 minutes. </td>
        <td>Same as #1 for this week.</td>
        <td>Same as #1 for this week.</td>
    </tr>
    <tr>
        <td>2</td>
        <td>4/3-4/9</td>
        <td>Warm up for 5 minutes. </td>
        <td>Same as #1 for this week.</td>
        <td>Same as #1 for this week.</td>
    </tr></table>

如何使用php和/或javascript只使表格可下载和打印。

How can make only the table downloadable and printable using php and/or javascript.

推荐答案

创建一个打印样式表,将除表格之外的所有内容设置为 display:none 。浏览器负责打印,而不是代码,并在执行此操作时使用打印样式表。

Create a print stylesheet that sets everything but the table to display: none. The browser takes care of printing, not your code, and uses your print stylesheet when doing so.

这篇关于如何使用php下载/打印页面的特定部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆