mittwald / typo3-web2pdf

A TYPO3 extension for rendering content as PDF
GNU General Public License v2.0
18 stars 20 forks source link

Plugin link leads to 404 #117

Closed derJake closed 3 years ago

derJake commented 3 years ago

I ran into an issue when trying to use the extension plugin to generate a PDF of TYPO3 page containing a tx_news detail plugin. I've included the web2pdf plugin below the tx_news plugin expecting to be able to download a PDF version of the page when I click the "Print Current Page" link provided by web2pdf, yet I encounter a 404 "ERR_INVALID_RESPONSE" page.

I've tried to track the error through xdebug and the pdf file is generated and seems to be read by the middleware which returns a response object with response code 200 all the way to the TYPO3 bootstrapper.

Expected behaviour: Clicking the plugin link returns a file stream with content-disposition header telling the browser to download the stream as a file.

Observed behaviour: A 404 error is returned with error const "ERR_INVALID_RESPONSE" being shown in the browser window.

Steps to reproduce:

  1. set up a TYPO3 10.4 installation via composer (e.g. TYPO3 composer helper)
  2. configure DB etc. in DDEV
  3. run composer require mittwald/web2pdf
  4. include Typoscript in Template
  5. put web2pdf plugin on page
  6. Click "Print Current Page" on said page

Environment: DDEV 1.16.2 PHP 7.4 MySQL 5.7 Apache 2.4.38 TYPO3 10.4.13

derghostface commented 3 years ago

I had the same problem when inserting the link on a record detail view. I solved it by adding addQueryStringMethod="GET" into the f:link.action in the GeneratePdfLink.html

derJake commented 3 years ago

@derghostface thanks for the suggestion!

Right now I had solved my problem by using the news view helper. <n:link newsItem="{newsItem}" settings="{settings}" class="c-button" configuration="{additionalParams: '&tx_web2pdf_pi1[argument]=printPage'}">