700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > qt html导pdf 页眉 如何使用wkhtmltopdf unpatched qt在每个页面上添加页眉和页脚?

qt html导pdf 页眉 如何使用wkhtmltopdf unpatched qt在每个页面上添加页眉和页脚?

时间:2018-12-04 00:06:44

相关推荐

qt html导pdf 页眉 如何使用wkhtmltopdf unpatched qt在每个页面上添加页眉和页脚?

我能弄清楚,我工作的解决方案。它非常混乱,但它的工作原理

控制器

public function printPDF(Request $request)

{

$parts = Parts::all();

$date = $this->getTime();

// divide by 36 because I can fit 36 items on each page

$totalPages = ceil(count($parts)/36);

$pdf = SnappyPdf::loadView('parts.print.landscape', ["parts" => $parts, "date" => $date->toFormattedDateString(), "totalPages" => $totalPages])

->setOrientation('landscape')

->setPaper('a4');

}

}

HTML

@php

$count = 0;

$page = 0;

@endphp

PARTS ORIENTATION

@foreach ($parts as $part)

@php

// 36 is the total number of items I can fit on a page

// so after 36 I add a header and footer

if ($count === 36) {

echo '

';

echo '

PARTS ORIENTATION

';

echo '

';

$count = 0;

$page++;

}

@endphp

alt="Error" width="127" height="127"/>

{{$part->text}}

@php

$count++;

if ($count == 36) {

// 36 is the total number of items I can fit on a page

// so after 36 I add a header and footer

$page = ($page == 0) ? 1 : $page;

echo '';

echo " $date ";

echo " $page of $totalPages ";

echo '';

}

elseif ($totalPages == $page) {

echo '';

echo " $date ";

echo " $page of $totalPages ";

echo '';

}

@endphp

@endforeach

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。