Skip to content

Commit

Permalink
Added no-cache options for bandi download
Browse files Browse the repository at this point in the history
  • Loading branch information
arrubiu committed Nov 17, 2017
1 parent ba8fe17 commit 5e295f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/custom/bandi/bandi.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ bandi.pdf:
_controller: '\Drupal\bandi\Controller\PdfController::view'
_title_callback: '\Drupal\bandi\Controller\PdfController::title'
requirements:
_permission: 'access content'
_permission: 'access content'
options:
no_cache: 'TRUE'
3 changes: 2 additions & 1 deletion modules/custom/bandi/src/Controller/PdfController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function view(EntityInterface $node, $view_mode = 'pdf', $langcode = NULL
'#theme' => 'bandipdf',
'#title' => parent::title($node),
'#content' => parent::view($node, $view_mode, $langcode),
'#cache' => ['max-age' => 0,],
];

$output = render($build);
Expand All @@ -39,7 +40,7 @@ public function view(EntityInterface $node, $view_mode = 'pdf', $langcode = NULL
$mpdf->SetHTMLFooter('<div class="footer">www.sardegnaimpresa.eu</div>');

$mpdf->WriteHTML($output);
$content = $mpdf->Output($this->title($node) . '.pdf', Destination::INLINE);
$content = $mpdf->Output($this->title($node) . '.pdf', Destination::DOWNLOAD);

$headers = [
'Content-Type: application/pdf',
Expand Down

0 comments on commit 5e295f5

Please sign in to comment.