yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.76k stars 858 forks source link

v6.0 How to edit settings for PDF export and print #284

Closed rogierborst closed 8 years ago

rogierborst commented 8 years ago

Is there any way to influence how the PDF is built up? Or the print export? I'd like to be able to add our company logo for example, and add a title. Maybe repeat headers on each page (both in PDF and in print).

If this is possible, where should I look for documentation?

yajra commented 8 years ago

For PDF, Excel & CSV, we use Laravel Excel package. You can also override the following methods to accomplish what you want to do.

protected function buildExcelFile() // build main excel file.
public function excel()
public function csv()
public function pdf()

For printing, you can create your own print preview file by setting the property:

protected $printPreview = 'path.to.view';

Lastly, there is no documentation yet for these developments.

RahamSher commented 8 years ago

Dear @rogierborst are you done pdf . If(true) then please guide me. Thank you.

yajra commented 8 years ago

Better exporting of PDF via laravel-snappy was released on v6.15.0. See PR https://github.com/yajra/laravel-datatables/pull/626 for more info. Thanks!

toriqsetiawan commented 5 years ago

Dear @yajra how to config if using another pdf library? such as dompdf. thanks

yajra commented 5 years ago

@setiawans see https://yajrabox.com/docs/laravel-datatables/master/buttons-config#pdf-generator for ref. However, it's been a long time since I used dompdf and not sure if it's still working. Thanks!

RayhanYulanda commented 4 years ago

file in vendor/datatables/print.blade.pdf is a template for generate pdf. It is general right? if i want to just change the html file what should i do? where should i define "user.blade.php"/"user" for the view template? and how passing the data? @yajra