Comments (11)
You can set this in your options (all of which are passed to wkhtmltopdf):
$config = [
'CakePdf' => [
'engine' => 'CakePdf.WkHtmlToPdf',
'options' => [
'print-media-type' => false,
'outline' => true,
'dpi' => 96,
'footer-center' => 'foobar HERE © ' . date('Y'),
'footer-right' => 'Page [page] of [toPage]',
],
'pageSize' => 'letter',
'orientation' => 'landscape',
'margin' => [
'bottom' => 15,
'left' => 50,
'right' => 30,
'top' => 45
],
It looks like there are some forks which have better integration for these settings
from cakepdf.
Also how to set the page number also. Can I know this. Because this seems to be an important features. If you already did it, perhaps you can put it in a proper documentation.
Thanx
from cakepdf.
fyi: #83
from cakepdf.
Hi zeroasterisk, nice info.
Does it support element to be set as header / footer also. I've seen quite a discussion about this in #83.
Do you happen to have a really good documentation on how to do this? Thanks
from cakepdf.
I have some example documentation with my PR on the README:
https://github.com/FriendsOfCake/CakePdf/pull/83/files#diff-04c6e90faac2675aa89e2176d2eec7d8R122
I haven't looked at this in a while, so the PR has not progressed, but I still think this is a good idea... header/footer being a very important piece of any PDF system. The truth is, you can make it work without my PR, my PR was tooling to try to make it simpler and more obvious... You can make a .html
file and pass the path to that as an option to wkhtmltopdf and that should work.
from cakepdf.
Nice zeroasterisk, so we can just use $this->element('element') as our header and footer right.. Thanks!
from cakepdf.
Hi,
Is there any way to add html content to footer Like "Powered By with an image"??
Thanks In Advance,
Amit
from cakepdf.
@amitpanwar86 yes - just put it in the HTML as an <img
with a full URL as the src
from cakepdf.
This code doesn't add any header/footer on my pdf..
Do you know why?
I'm using cakephp 3.1 and my cakepdf component is working on the engine WkHtmlToPdf.
This is my code:
$this->viewBuilder()->options([
'pdfConfig' => [
'filename' => 'audizione_' . $id.'.pdf',
//'print-media-type' => false,
//'outline' => true,
'dpi' => 500,
'margin' => [
'bottom' => 5,
'left' => 4,
'right' => 4,
'top' => 5
],
'orientation' => 'portrait',
'download' => true,
'header-html' =>'Ciao'
//'engine' => 'CakePdf.WkHtmlToPdf',
'options' => [
'print-media-type' => false,
'outline' => true,
'dpi' => 96,
'footer-center' => 'foobar HERE © ' . date('Y'),
'footer-right' => 'Page [page] of [toPage]',
],
]
]);
from cakepdf.
@filippogiordano please check wkhtmltopdf --version
from cakepdf.
I solved the problem with this configuration.
Configure::write('CakePdf', [
'engine' => [
'className' => 'CakePdf.WkHtmlToPdf',
'binary' => '/usr/local/bin/wkhtmltopdf',
'options' => [
'print-media-type' => false,
'outline' => true,
'dpi' => 500,
'header-html'=>"http://.....headeraddress",
'footer-html'=>"http://...footeraddress",
'footer-right'=>"Pag. [page] di [toPage]",
'header-spacing'=>1,
'footer-spacing' => '1',
],
],
'margin' => [
'bottom' => 20,
'left' => 20,
'right' => 20,
'top' => 45
],
'download' => false
]);
and adding to the first line of my header and footer html:
from cakepdf.
Related Issues (20)
- CakePdf configuration ignored by the plugin HOT 2
- Add debug option for PDF rendering engine - fonts not rendering HOT 1
- CakePHP 4.x Compatibility HOT 3
- Adapt project description to mention CakePHP 4 HOT 1
- Stable release for CakePHP 4 HOT 2
- Its showing Failed to load PDF document HOT 1
- Error with Cakephp4 HOT 1
- $CakePdf->viewVars($this->_View->viewVars); problem
- wkhtmltopdf binary is not found or not executable - getBinaryPath()
- Include CSS Files in Command does not work HOT 2
- Error in documentation HOT 2
- parameters not passed to mPDF engenie HOT 3
- Using PHP8 impossible with current configuration HOT 2
- Missing CSS with wkhtmltopdf 0.12.6
- Custom Engine possible? (Trying weasyprint) HOT 1
- Problemas ao usar wkhtmltopdf HOT 3
- Windows IIS PHP 8.0.12 System error "'""c:\wkhtmltopdf\bin\wkhtmltopdf.exe" is not recognized as an internal or external command HOT 1
- Support for CakePHP version 4.3 HOT 1
- Loading fonts on CakePHP 4 from Google Fonts HOT 1
- Linux server cannot run direct /usr/bin/wkhtmltopdf
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakepdf.