- 🇩🇪Germany jan kellermann
Drupal 7 is end of live.
If you want to use PDF using mPDF → for your Drupal 10/11 please checkout new version 3.x → .
Hello, since I want the path to the pdf to end in .pdf I had to do several things which I explain here so you can do the same if you want :
- create a rule in .htaccess
RewriteRule ^ebook-(.+)_(.+).pdf$ /index.php?q=node/$2/pdf [NC,QSA,L]
- create a block to display only on nodetype's pages, in php :
<?php
if ($node = menu_get_object()) {
$nid = $node->nid;
$ntitle = $node->title;
$npath = drupal_get_path_alias("node/".$nid);
}
$nfullpath = 'ebook-'.$npath.'_'.$nid.'.pdf';
echo '<div style="text-align:center;"><a href="/'.$nfullpath.'" title="'.$ntitle.'"><img src="/path/to/pdfdownload.png" width="128" height="128" alt="'.$ntitle.'" /></a></div>';
?>
- in the module settings I use this for the filename :
ebook-[node:url:alias]_[node:nid]
- in order to stop display the "Generate PDF" link above the content, one line needs to be changed in the module :
line 61 instead of
'type' => MENU_LOCAL_TASK,
I write
'type' => MENU_CALLBACK,
so that at the end :
on my articles, I have a block showing a PDF DOWNLOAD image link which links to the nice path of the pdf file
ebook-keywords-here_nodeID.pdf
which .htaccess redirects to /index.php?q=node/nodeID/pdf
so the PDF file is created and in the http headers the filename of the PDF is still the same
At the end it really looks like the PDF file is a real one, not an auto-generated one.
Hope it helps someone using this nice module.
Closed: outdated
2.6
User interface
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Drupal 7 is end of live.
If you want to use PDF using mPDF → for your Drupal 10/11 please checkout new version 3.x → .