pdf_using_mpdf.module in PDF using mPDF 8
Same filename and directory in other branches
Generates PDF for given html.
File
pdf_using_mpdf.moduleView source
<?php
/**
* @file
* Generates PDF for given html.
*/
use Drupal\Core\Link;
use Drupal\Core\Url;
/**
* Implements hook_help().
*/
function pdf_using_mpdf_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
$output = '';
$html = 'This module is used for converting an HTML of a page to PDF using ';
$html .= 'the mPDF PHP Library. This module allows you to generate the pdf ';
$html .= 'documents of any node:<p><strong> PDF creation ';
$html .= '( www.example.com/node/[nid]/pdf ) </strong></p><p> where nid is ';
$html .= 'the node id of a node. </p> By creating your own CSS file and/or ';
$html .= 'the node.tpl.php template files, it is possible to change the look ';
$html .= 'of the output page to suit your taste.For a more fine-grained ';
$html .= 'customization, it is possible to use a twig file named: <p><strong> ';
$html .= 'node--[node-type|node-id].twig.html </strong></p><p> located in the ';
$html .= 'active theme directory. </p><p> Where node-type and node-id are ';
$html .= 'Drupal node type (for example page, story, etc.) and node id (for ';
$html .= 'example 10) respectively. </p> <p>You must run <em>composer.json</em>';
$html .= 'file (provided with this module) to install the third-party tool ';
$html .= '- %mPDF - to generate PDF files </p><p> Please follow the ';
$html .= 'instructions in the README.txt file carefully. </p>';
$link = Url::fromUri('http://www.mpdf1.com/mpdf/index.php');
$link = Link::fromTextAndUrl('mPDF', $link)
->toString();
if ($route_name == 'help.page.pdf_using_mpdf') {
$output = t($html, [
'%mPDF' => $link,
]);
}
return $output;
}
Functions
Name | Description |
---|---|
pdf_using_mpdf_help | Implements hook_help(). |