I want to use pagenumbering in mpdf with tags how its described in mpdf manual:
http://mpdf1.com/manual/index.php?tid=109
Problem is I have used smarty template engine and there I can not use mpdf tag {PAGENO} in header/footer direct in html template, because I think smarty expected in {} parentheses variables. ( example {$test} )
So when I define {PAGENO}, smarty get syntax error: unrecognized tag 'PAGENO' ...
also I have tried to call this metod, but it's not working->when I generate pdf, in generated pdf is nothing regarding page numbering:
// Set a simple Footer including the page number
$mpdf->setFooter('{PAGENO}');
Have anybody some idea, how I could use mpdf page numbering with smarty template engine?
thx
Just use {literal} in your html template:
{literal}{PAGENO}{/literal}
Related
I am working on PDF generation using the MPDF library into a Drupal 8 project.
I am planning to put the table of contents (TOC) inside a <div> on the first page of my PDF.
For that, I created a <tocentry> tags and put the <tocpagebreak /> into my <div> of the first HTML page.
Unfortunately, the TOC is generated in a new page (i.e., page break is happening before and after the TOC).
How can I generate the TOC within my custom HTML structure and include it into my <div>?
By default the TOC goes at the bottom, but you can modify its position manually.
In mPDF's docs there's a nice example in which the TOC is before the content:
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('Introduction');
$mpdf->TOCpagebreak();
$mpdf->TOC_Entry("Chapter 1", 0);
$mpdf->WriteHTML('Chapter 1 ...');
$mpdf->Output();
Notice that TOCpagebreak() is invoked before TOC_Entry (the function that adds the entry to the TOC) and before WriteHTML('Chapter 1 ...'). This latter function adds content to the PDF.
By placing TOCpagebreak() before those functions, you make the TOC appear before the contents.
For more details, see mPDF docs on TOCpagebreak()
I'm using PHPWord in my SF2.8 application, and i would like to use a twig as template for my docx it works but there is no CSS. How can I do to put CSS ?
Thanks a lot !
I'm using php library mpdf for generating pdf files from HTML content. For short paragraph text mpdf is working normally but when there is more than one page long content mpdf is generating pdf file within a single page with very small font. It doesn't worked when I gave sufficient font-size.
Is there any parameter that can be set for page break in mpdf ?
Please use <div> instead of using <table>. MPDF will shrink the content inside <tr> <td> to o
I would like to put a footnote in my PDF, created by MPDF from html. I didn't find any function or tag for that. I tried put notes in footer, changing it by tag, but that was changing footers for all even/odd pages. Maybe is there a way to change footer starting from next page? Then I would change footer with my note text and immediately after change it to standard footer.
$mpdf->SetFooter('{DATE d/m/Y }|{PAGENO}/{nb}|Sym Consultoria');
I want to generate a PDF of a webpage but apply an alternate, print-type stylesheet to it instead of the styles it uses now. Say, for example, I have a button on http://eorailway.co.uk to generate a PDF of the same page (which is run and administered by me, so therefore I can include any PHP/JS necessary to each page) but I want to apply alternate styling to it before generating the PDF.
At the moment I am using the dompdf PHP library to generate the PDF using the normal/default stylesheet, but cannot for the life of me think how to apply the alternate stylesheet to the page when clicking the "Generate PDF" button.
Any advice is most appreciated.
Since the site is under control, you could dynamically decide which stylesheets to include based on a query string parameter. i.e. http://example.com/page.php?stylesheet=print would have your template output only the alternate stylesheet, and your PDF library would fetch that page to generate.
I would recommend making an alternate page with the "print" stylesheet applied and point to it using the print meta tag. (e.g. <link rel="alternate" media="print" href="<? ECHO $_SERVER['PHP_SELF'].'?print'; ?>""> )
Then have PHP determine the stylesheet to use based on the presence of that GET variable.
You can use the DOMXML stuff in php to apply a specific XSLT file to some XML:
$stylsheet = "Example.xsl";
$xsldoc = domxml_xslt_stylesheet_file($stylsheet);
$htmldoc = $xsldoc->process($xmldoc);
$results_page = $xsldoc->result_dump_mem($htmldoc);
That's something I did in php4, might be an easier way in 5.
In the 0.6.0 release of DOMPDF you can specify the stylesheet to use by modifying the DOMPDF_DEFAULT_MEDIA_TYPE configuration constant.
http://code.google.com/p/dompdf/source/browse/trunk/dompdf/dompdf_config.inc.php?r=336#234