yii2 pdf bilan ishlash

+1 ovoz
63 marta ko‘rilgan
so‘radi 24 noyabr, 18 user_best (125 bal)
ko‘rsatildi 13 yanvar Saidolim
Qanday qilib yii2 da pdf ga chop qilishda sahifalasa bo'ladi

Масалан 5 бетлик печать версия 2-саҳифаси 2/5 кўринишида рақамланиши кк.

2 Javoblar

+2 ovoz
javob berdi 24 noyabr, 18 Sardor Dushamov (1,618 bal)

Mpdf kutubxonadan foydalanib html yoki boshqa ma’lumotni pdfga aylantirishiz mumkin.

Ushbu kutubxonada Pagenumber degan metodi bor, shu orqali chiqarishiz mumkin.

Batafsil: https://mpdf.github.io/headers-footers/page-numbers-date.html

+1 ovoz
javob berdi 12 yanvar user_best (125 bal)
ko‘rsatildi 13 yanvar Saidolim
$searchModel = new AnnualEventsSearch();
        $dataProvider = $searchModel->searchByAnnual(Yii::$app->request->queryParams,$school_id);
        $dataProvider->pagination = ['pageSize' => 1000,];
        $dataProvider = $dataProvider->getModels();

        Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
        $headers = Yii::$app->response->headers;
        $headers->add('Content-Type', 'application/pdf');

        $content = $this->renderPartial('@app/views/annual-events/print_annual',[
            'dataProvider' => $dataProvider,
        ]);

        $pdf = new Pdf([
            'mode' => Pdf::MODE_CORE,
                // A4 paper format
            'format' => Pdf::FORMAT_A4,
                // portrait orientation
            'orientation' => Pdf::ORIENT_PORTRAIT,
                // stream to browser inline
            'destination' => Pdf::DEST_BROWSER,
                // your html content input
            'content' => $content,  
                // format content from your own css file if needed or use the
                // enhanced bootstrap css built by Krajee for mPDF formatting
            'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
                // any css to be embedded if required
            'cssInline' => '.kv-heading-1{font-size:18px}',
                // set mPDF properties on the fly
            'options' => ['title' => 'Krajee Report Title'],
                // call mPDF methods on the fly
            'methods' => [
                'SetHeader'=>[$fio->name.'-Maktab'],
                'SetFooter' => ['|{PAGENO}/{nbpg}'],
            ]
        ]);

Assalomu alaykum, yordam.uz saytimizga xush kelibsiz.

Bu saytda o`zingizni qiziqtirgan savollarga javob olishingiz va o`z sohangiz bo`yicha savollarga javob berishingiz mumkin.

Bizning Oilamizga a'zo bo`lganingiz uchun chuqur Minnatdorchilik bildiramiz !!!

Telegram kanal YordamUzRss

...