简体   繁体   中英

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

How to use the 2 library at the same laravel app. I want to use the DOMPDF for 1 page pdf and the TCPDF for multiple pages(1000 pages). but the problem is that the TCPDF is overwriting all the functions of the dompdf. What is the best way to use these 2 vendors in same laravel app? 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. I dont want them to redo all the things they have finished using the DOMPDF.

I guess they both register an alias named 'PDF', so if you call a function by it's alias:

PDF::generate() 

then DOMPDF is taking precedence. You should use the complete namespace for each package to avoid collisions or create different alias for them in the config/app.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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