简体   繁体   English

如何在一个 laravel 应用程序(如 TCPDF 和 DOMPDF)中使用 2 个供应商?

[英]How to use 2 vendors at one laravel app like TCPDF and DOMPDF?

How to use the 2 library at the same laravel app.如何在同一个 laravel 应用程序中使用 2 个库。 I want to use the DOMPDF for 1 page pdf and the TCPDF for multiple pages(1000 pages).我想将 DOMPDF 用于 1 页 pdf 和 TCPDF 用于多页(1000 页)。 but the problem is that the TCPDF is overwriting all the functions of the dompdf.但问题是 TCPDF 覆盖了 dompdf 的所有功能。 What is the best way to use these 2 vendors in same laravel app?在同一个 laravel 应用程序中使用这两个供应商的最佳方法是什么? We are team that work in single laravel app and I am using TCPDF for multiple pdf export and they are using dompdf for 1 page pdf only.我们是在单个 laravel 应用程序中工作的团队,我使用 TCPDF 进行多个 pdf 导出,他们仅将 dompdf 用于 1 页 pdf。 I dont want them to redo all the things they have finished using the DOMPDF.我不希望他们重做他们使用 DOMPDF 完成的所有事情。

I guess they both register an alias named 'PDF', so if you call a function by it's alias:我猜他们都注册了一个名为“PDF”的别名,所以如果你用它的别名调用 function:

PDF::generate() 

then DOMPDF is taking precedence.那么 DOMPDF 优先。 You should use the complete namespace for each package to avoid collisions or create different alias for them in the config/app.php您应该为每个 package 使用完整的命名空间以避免冲突或在 config/app.php 中为它们创建不同的别名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM