Hello everyone,
I'd like to know if it is possible to customize the pages footer in a PDF export (inserting a label, a dynamic label) ?
Thank you for answers...
Hello everyone,
I'd like to know if it is possible to customize the pages footer in a PDF export (inserting a label, a dynamic label) ?
Thank you for answers...
Hi,
you can use the --footer-html option in wkhtmltopdf. See wkhtmltopdf manual for more info.
--
myDBR Team
Thank you,
but I don't see where I can add an option like that ?
Where do you customize the "command line" while calling wkhtmltopdf in myDBR ?
I've tried to find the "--header-html" string (used in the actual command line) in all /myDBR/ subdirectory : unsuccessfull...
See documentation for command options and examples.
--
myDBR Team
OK thank you, I have found what I needed, and it works.
Just one comment : it is said that you can stop using default header command by inserting select 'dbr.wkhtmltopdf', "--header-html ''"; : I have tried but it throws an error.
Also with select 'dbr.wkhtmltopdf', "--header-html";
Finally I inserted select 'dbr.wkhtmltopdf', "--header-html http://127.0.0.1/myDBR/user/export_header_pdf_empty.php" with a custom empty php file...
You're missing the empty string parameter for the --header-html.
select 'dbr.wkhtmltopdf', "--header-html ''";
--
myDBR Team
No, that is exactly what I have inserted and here is the result :
There was an error (code:-1073741819) producing the pdf document
Failed command: C:\"Program Files (x86)"\wkhtmltopdf\wkhtmltopdf -q --header-html '' --margin-top 13 C:\Users\Philippe\AppData\Local\Temp\885460508.html -
OK,
try to set the export debug on and run the command from command line without the -q parameter. You should see more information why the command fails.
--
myDBR Team
Ok, in fact I found what caused the problem : I must intervert ' and " :
select 'dbr.wkhtmltopdf', '--header-html ""';
...works fine !
But now I have another problem !!
When I use accentuated characters (remmeber I'm french ;), it doesn't work well !
Example :
I have inserted that code :
select 'dbr.wkhtmltopdf', '--margin-top 10 --header-html "" --margin-bottom 20 --footer-html "http://127.0.0.1/myDBR/user/export_footer_pdf.php?pEtablissement=compiègne';
...and here is the generated command line :
C:\"Program Files (x86)"\wkhtmltopdf\wkhtmltopdf -q --margin-top 10 --header-html "" --margin-bottom 20 --footer-html "http://127.0.0.1/myDBR/user/export_footer_pdf.php?pEtablissement=compiègne C:\Users\Philippe\AppData\Local\Temp\429019811.html -
How to manage that ?
Accented characters needs to be encoded in URL's. Also, make sure your footer html has correct charset.
--
myDBR Team
OK, I understand, but how can I encode that URL (generated by myDBR itself) ?
What directive, syntax should I use in my myDBR code ?...
In addition, at this point, my footer html is not used yet...the calling URL is already wrong.
You urlencode the parameter in SQL. You can make a function out of that.
--
myDBR Team
Ok, I've solved the problem.
In myDBR MySQL database I created a function urlencode() and I use it as this :
select 'dbr.wkhtmltopdf', concat('--margin-top 10 --header-html "" --margin-bottom 20 --footer-html "http://127.0.0.1/myDBR/user/export_footer_pdf.php?pEtablissement=', urlencode(pEtablissement), '"');
Thank you for your help.
You must log in to post.