In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "generating pdf tutorials under the laravel framework". In daily operation, I believe many people have doubts about generating pdf tutorials under the laravel framework. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "generating pdf tutorials under the laravel framework". Next, please follow the editor to study!
Baidu has two choices, laravel-dompdf and laravel-snappy, written by an author.
Laravel-dompdf was chosen at the beginning, because it is easier to transplant than the latter, but when it comes to the problem of garbled Chinese characters, it is useless to try several solutions. I heard that other people think highly of laravel-snappy, so I switched to the latter.
Github address: https://github.com/barryvdh/laravel-snappy
First of all, for the record, I only need to generate pdf, not pictures.
Step 1: install Wkhtmltopdf
Download Wkhtmltopdf (https://github.com/KnpLabs/snappy#wkhtmltopdf-binary-as-composer-dependencies), I use composer mode:
Composer require h5cc/wkhtmltopdf-amd64 0.12.x
This is the only sentence on the whole page that works for me.
Step 2: install laravel-snappy
Go back to the laravel-snappy (https://github.com/barryvdh/laravel-snappy) page
Cp vendor/h5cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 / usr/local/bin/chmod + x / usr/local/bin/wkhtmltopdf-amd64
I didn't use these two sentences for portability. If multiple projects need to be converted to pdf, you can refer to this method.
After the configuration file is generated, there are two ways to reference wkhtmltopdf:
Mode one
'binary' = > base_path (' vendor/h5cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'), / / the one I use
Mode two
'binary' = >' / usr/local/bin/wkhtmltopdf-amd64', / / linux environment 'binary' = >' "C:\ Program Files\ wkhtmltopdf\ bin\ wkhtmltopdf" / / windows environment
Finally, to solve the problem of Chinese garbled code, search a Chinese font library on the Internet and put it on / usr/share/fonts/ (my server is CentOS7,windows to find a solution / wink). I downloaded sumsin.ttf (https://ufonts.com/download/simsun.html) here.
These are the only points you need to pay attention to. Just refer to the official tutorials for others.
At this point, the study of "generating pdf tutorials under the framework of laravel" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.