forked from mittwald/typo3-web2pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
361a133
commit 4479695
Showing
2 changed files
with
9 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,13 +29,9 @@ | |
use Psr\Http\Message\ServerRequestInterface; | ||
use Psr\Http\Server\MiddlewareInterface; | ||
use Psr\Http\Server\RequestHandlerInterface; | ||
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; | ||
use TYPO3\CMS\Core\Database\ConnectionPool; | ||
use TYPO3\CMS\Core\Http\JsonResponse; | ||
use TYPO3\CMS\Core\Http\Response; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
|
||
/** | ||
* Middleware provides generation of full html page as PDF | ||
* @author Ricky Mathew <[email protected]> | ||
|
@@ -53,12 +49,12 @@ class PdfRender implements MiddlewareInterface | |
*/ | ||
protected $view; | ||
|
||
|
||
/** | ||
* Instantiates necessary objects | ||
* | ||
*/ | ||
public function __construct() { | ||
public function __construct() | ||
{ | ||
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); | ||
$this->view = $this->objectManager->get('Mittwald\\Web2pdf\View\\PdfView'); | ||
} | ||
|
@@ -68,9 +64,12 @@ public function __construct() { | |
*/ | ||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface | ||
{ | ||
//TODO set condition to distinguidh pdf rendering request also need to pass the page title as second parameter in renderHtmlOutput() | ||
$this->view->renderHtmlOutput($GLOBALS['TSFE']->content,''); | ||
$arguments = $request->getQueryParams(); | ||
if (isset($arguments['tx_web2pdf_pi1']) && $arguments['tx_web2pdf_pi1']['argument'] == 'printPage') { | ||
$response = $handler->handle($request); | ||
$this->view->renderHtmlOutput($GLOBALS['TSFE']->pageRenderer->getBodyContent(),$GLOBALS['TSFE']->page['title']); | ||
} | ||
return $handler->handle($request); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters