Print current and total page number value in repeatable custom header at custom position
Closed this issue · 2 comments
wpteam4 commented
wpteam4 commented
Code I'm using:
use dawood\phpChrome\Chrome;
$chrome=new Chrome('https://youtube.com','/usr/bin/google-chrome');
$chrome->setOutputDirectory(DIR);
//not necessary to set window size
$chrome->setWindowSize($width=1477,$height=768);
print "Pdf successfully generated :".$chrome->getPdf().PHP_EOL;
daudmalik06 commented
Hello, although this is a bit old, I'm answering it anyway as it might be useful for others.
Directly setting headers and footers with this library is not possible, but it can be achieved using CSS print queries. Here's an example:
<head>
<style>
@media print {
.header {
position: fixed;
top: 0;
width: 100%;
text-align: center;
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
}
}
</style>
</head>
<body>
<div class="header">This is the header</div>
<div class="content">Your page content here</div>
<div class="footer">This is the footer</div>
</body>
</html>