php 如何使用 CSS 引导类从 HTML 生成 PDF

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34355775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 23:56:03  来源:igfitidea点击:

How to generate PDF from HTML with CSS bootstrap classes

phphtmlcsstwitter-bootstrappdf

提问by felipe muner

I have a table with classes bootstrap3 css and I want to generate a PDF from this table...

我有一个带有 bootstrap3 css 类的表,我想从这个表生成一个 PDF ......

What is the best way to do this?

做这个的最好方式是什么?

I need that keep my style css My table:

我需要保持我的样式 css 我的表:

        <table id="tabelaVisitaSickbay" class="table table-striped table-hover table-bordered">
            <tbody>
            <tr>
                <th colspan="2">Visits to the SickBay</th>
            </tr>
            <tr>
                <td>Botafogo Pre-Nursery and Nursery</td>
                <td id="visitaBotaPrenurseryAndNursery" class="atendimentoVisitSickBay"></td>                   
            </tr>
        </tbody>

Thanks for help & pointers in advance.

提前感谢您的帮助和指点。

回答by user1914292

You're right most tools as mentioned on this site do not support Bootstrap (fully). There are two APIs out there, who's sites are actually in Bootstrap as well. They're built by the company I work for (disclaimer):

您说得对,本网站上提到的大多数工具都不支持 Bootstrap(完全)。那里有两个 API,他们的站点实际上也在 Bootstrap 中。它们由我工作的公司建造(免责声明):

  • HTM2PDF- has a HTML to PDF API for all programming languages and an SDK in PHP
  • PDFmyURL- has a webpage to PDF API, an API for complete websites to PDF and libraries in PHP and .NET
  • HTM2PDF- 具有适用于所有编程语言的 HTML 到 PDF API 和 PHP 中的 SDK
  • PDFmyURL- 有一个网页到 PDF API,一个完整的网站到 PDF 和 PHP 和 .NET 库的 API