如何在 Laravel 5.3 中安装 dompdf?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43818188/
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
How to install dompdf in laravel 5.3?
提问by samuel toh
I had install laravel-dompdf follow this : https://github.com/barryvdh/laravel-dompdf
我已经安装了 laravel-dompdf 按照这个:https: //github.com/barryvdh/laravel-dompdf
But after i use that pdf, laravel-dompdf many shortcomings. It can not display: flex, float etc
但是在我使用那个 pdf 之后,laravel-dompdf 有很多缺点。不能显示:flex、float等
And after I search in google, I find this : https://github.com/dompdf/dompdf
在谷歌搜索后,我发现了这个:https: //github.com/dompdf/dompdf
Are these two links the same?
这两个链接一样吗?
Are dompdf and laravel-dompdf the same?
dompdf 和 laravel-dompdf 是一样的吗?
I see the second link (dompdf), it looks like it's a lot of updates.
我看到第二个链接(dompdf),看起来更新很多。
How do I install dompdf besides laravel-dompdf?
除了laravel-dompdf,如何安装dompdf?
回答by trollkotze
The second one, https://github.com/dompdf/dompdfis the original core library, a pure PHP library.
第二个,https://github.com/dompdf/dompdf是原核心库,纯PHP库。
The first one, https://github.com/barryvdh/laravel-dompdfis a wrapper libraryfor using DomPDF in Laravel.
第一个,https://github.com/barryvdh/laravel-dompdf是在 Laravel 中使用 DomPDF的包装库。
You need the second one, which will automatically include and use the first one, upon proper installation.
您需要第二个,它会在正确安装后自动包含并使用第一个。
The DomPDF core library has more recent commits, but the newest released version (at the time of this posting) is 0.8, which is the same which is used in the wrapper library for Laravelcurrently. The more recent commits in the DomPDF coreGitHub repository have not yet been made to a new release, but it seems from the commit historythe features you mentioned have also not been implemented in those newer commits yet.
DomPDF 核心库有更多最近的提交,但最新发布的版本(在本文发布时)是 0.8,这与当前Laravel 的包装库中使用的版本相同。DomPDF 核心GitHub 存储库中的最新提交尚未发布到新版本,但从提交历史记录来看,您提到的功能似乎还没有在这些新提交中实现。
So the Laravel wrapper DomPDF is using the most current released version of the vanilla PHP library DomPDF, which is fine.
所以 Laravel 包装器 DomPDF 使用的是香草 PHP 库 DomPDF 的最新发布版本,这很好。
The DomPDF core Readmesays:
该DOMPDF核心自述说:
Handles mostCSS 2.1 and a fewCSS3 properties, including @import, @media & @page rules
处理大多数CSS 2.1 和一些CSS3 属性,包括 @import、@media 和 @page 规则
(boldemphasis mine)
(粗体强调我的)
So not even CSS 2.1 is completely supported yet. There are missing features. I assume flex and float are among those as of yet unsupported features.
所以甚至还没有完全支持 CSS 2.1。有缺失的功能。我认为 flex 和 float 属于尚未支持的功能。
You would have to wait for them to be included in the DomPDF core library in some future version, and then, for the Laravel Wrapper to be updated as well to that new version.
您将不得不等待它们被包含在未来某个版本的 DomPDF 核心库中,然后,Laravel Wrapper 也会更新到该新版本。