[TYPO3-mvc] Action with HTML and PDF

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jan 5 12:43:25 CET 2011


Hey,

> <f:link.action action="card">Scoring Card</f:link.action>
> <f:link.action action="card" format="pdf">Card (PDF)</f:link.action>
>
> Later I will generate the PDF dynamic with fpdf or another extension.
> Now I will deliver a static Dokument and change the behaviour later.
>
> In the Template directory of the Controller I have two files for these
> Action. card.html and card.pdf.
>
> In the TS I write:
>
> pdf = PAGE
> pdf {
>    typeNum = 203
>    10<  tt_content.list.20.myext_pi1
>
>    config {
>      disableAllHeaderCode = 1
>      additionalHeaders = Content-type:application/pdf
>      xhtml_cleaning = 0
>      admPanel = 0
>    }
> }
>
> This I found in the book from Jochen and Sebastian.
>
> If I click the PDF Link, then parameter
>
> tx_myext_pi1[format]=pdf
>
> was added to the URL, but it has no effect. The content of the PDF-File
> was shown in the same template like the HTML. If I add type=203 to the
> URL manually, the browser pop up the file-dialog with index.php as the
> filename. After saving, I can't open the file with PDF-Reader. The
> header of the PDF looks the same, but the downloaded file is bigger than
> the original in the Template-Folder.

the link attribute "format=pdf" is not the same as the pageType. If you 
like to switch to a specific pageType as well as change the default 
template suffix to PDF you have to use both attributes in your PDF link:

<f:link action="card" format="pdf" additionalParams="&type=203">Card 
(PDF)</f:link.action>

Something like this I suppose (not sure about the additionalParams 
part/syntax).

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list