【问题标题】:How do I line up an html document for print so the pages are not cut off?如何排列要打印的 html 文档,以免页面被截断?
【发布时间】:2014-11-06 15:43:38
【问题描述】:

我在 iframe 中有一个 HTML 文档,人们将打印出来,我已经对其进行了编码,以便在打印时看起来不错。有一个页脚和一个页眉,每个页面的页眉都会发生变化,并且每个页面都在它自己的 div 标签内。我希望人们能够点击文档的打印按钮,并且每个页面都打印在自己的页面上,而不会被截断,并确保页脚位于每页的底部。有没有办法做到这一点?我很想得到一些帮助,因为它让我发疯!如果一页太短,下一页会打印在同一页上,然后在中途被切断,这看起来很糟糕。

这是我设置它的地方.. http://morecleanenergy.com/graphics/testproposal/index.html

这是其中一页..

<div style="size:210mm 297mm;">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="Proposalheader">
        <tr>
            <td align="left" width="169"><img src="faq.png" height="57px"></td>
            <td width="732"></td>
        </tr></table>
    <div class="pageBody">
        <span class="generalText"><p><strong>Who is Clean Energy Collective?</strong></p>
            <p>Clean Energy Collective (CEC) is a Colorado-based company that develops, operates and maintains community-owned solar arrays, also referred to as solar gardens or community solar farms. CEC's innovative model makes local renew- able energy easy, accessible and a financially smart decision for electricity consumers in the United States.</p>
            <p><strong>What is CEC Community Solar?</strong></p>
            <p>Clean Energy Collective community solar enables you to own solar panels in a centralized, community-based array. As your panels produce clean electricity, you receive credits directly on your monthly electric bills for the power produced. By owning a solar power system in a community array, you can reduce or eliminate your electric bills, protect against rising prices, and experience monthly savings in place of a monthly expense.</p>
            <p><strong>What happens to the electricity produced by the panels?</strong></p>
            <p>The clean solar power is automatically delivered to the Xcel Energy's grid, increasing the utility's incorporation of renewable energy and decreasing its reliance on fossil fuels. The power is not delivered directly to your meter and no equipment is required to be installed on your property.</p>
            <p><strong>Do I need to own a home or building to participate?</strong></p>
            <p>No. If you have an electric bill, you can receive credits for the power produced by solar panels in a CEC communi- ty-owned solar array.</p>
            <p><strong>How can I monitor my panels' performance?</strong></p>
            <p>As a CEC customer, you can log on to your My Own Clean Energy account via the CEC website and smartphone app. There you can see your system's information, review your customer documents, and access real-time information about your portion of the array's production, bill credits, and positive environmental impact.</p>
            <p><strong>What happens if I move?</strong></p>
            <p>If you move within your county, simply have your panels' bill credits applied to your new location's meter and account with the utility. If you leave the county or the Xcel Energy territory, you may sell the panels to another Xcel Energy customer in your county or give a tax-deductible gift of clean energy by donating the system to a charity in your county.</p>
            <p><strong>How much solar can I buy?</strong></p>
            <p>Systems are available from a minimum of 1 kilowatt (kW) up to 120% of your average annual usage.</p>
            <p><strong>How are my monthly electric bill credits calculated?</strong></p>
            <p>Each month, your Xcel Energy electric bill will be credited for your panels' production. The power produced is credited at the specific rate for your customer class as determined under Xcel Energy's Solar*Rewards Community Program. These initial credit rates will increase as Xcel Energy's electricity rates increase, protecting you against the national trend of rising electricity costs.</p>
            <p><strong>How are my monthly electric bill credits calculated?</strong></p>
            <p>As Xcel Energy's electricity prices rise, the bill credit rate you receive for the panels' output will increase as well. As your monthly bill credits increase, your system's savings increase.</p></span>
    </div>
    <div><img src="footer.png" style="width:100%;"></div>
</div>

【问题讨论】:

    标签: html css iframe layout printing


    【解决方案1】:

    尝试将 page-break-after css 属性应用到您的页脚。 http://www.w3schools.com/cssref/pr_print_pageba.asp

    【讨论】:

    • 那我该如何实现呢?我会在每页的末尾添加一个
    • 看起来你已经在每个页面的末尾有一个 div 来显示页脚图像。像您提到的那样,向其中添加一个类,并将该类设置为“page-break-after:always”应该会给您想要的效果。
    猜你喜欢
    相关资源
    最近更新 更多
    热门标签