> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# PDF display of the product detail view

> How to offer buyers the product data as a downloadable PDF file in WEBSALE V8s, via a separate template.

On the product detail view, you can offer buyers the option of downloading the product data as a PDF file. The file is generated from a separate template that is designed independently of the product page. This lets you create, for example, a data sheet with its own layout and optional personal notes.

The buyer receives the result as a download, not as a page view in the browser.

## Extending the shop configuration

Three sections of the `shop.config` are involved. Create any missing sections and parameters.

### Assigning the template

The `ProductPDF` parameter in the `<Templates>` section names the template from which the PDF file is generated.

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<Templates>
   ...
   ProductPDF   = ws_product_pdf.htm
   ...
</Templates>
```

### Defining the file name

The `<PDFGenerator>` section determines the name under which the file reaches the buyer.

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<PDFGenerator>
   ProductPDFFilename   = product_~ProductNumber~.pdf
</PDFGenerator>
```

The same section also contains the file names of the shop's other PDF functions, for example for the basket and the order confirmation. `ProductPDFFilename` is the entry for the product detail view.

Reference: [PDFGenerator section](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/grundlagen-und-technik.md#pdfgenerator)

### Storing the error message

If the generation fails, the shop shows the notify page with this text. Store it in the `<NotifyMessages-Txt>` section.

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<NotifyMessages-Txt>
   ...
   PDFGeneratorError   = Die PDF-Datei konnte leider nicht erzeugt werden.
   ...
</NotifyMessages-Txt>
```

Reference: [NotifyMessages-Txt section](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/texte-und-meldungen.md#notifymessages-txt)

## Adding the button to the product detail view

The button belongs in the product form, because the generation is triggered by submitting it.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
...
<form action="~FORM-Product~" method="post" name="product" id="productform">
   ...
   <input type="submit" name="~BT-GeneratePDF~" value="PDF erzeugen">
   ...
</form>
...
```

## Determining the cause of an error

If an error occurs, the buyer lands on the notify page with the text stored above. The technical cause is in `MSG-InternalErrorMessage`. Add this block to the notify template if it is still missing.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
...
<!--
{MSG-InternalErrorMessage}
Fehler: ~MSG-InternalErrorMessage~
{/MSG-InternalErrorMessage}
-->
...
```

> [!WARNING]
>
> Only include this tag within an HTML comment. Internal error messages must not appear to the buyer in plain text. You can still read the message via the browser's source code view if an error occurs.

Reference: [MSG-InternalErrorMessage](https://dokumentation.websale.de/en/v8s/referenz/tags/msg-meldungen.md#other-messages)

Possible causes also include a timeout during generation. For the buyer, this looks exactly like a content error, but it can be distinguished in the source code.

## Related topics

* Guide: [Displaying the selected product](https://dokumentation.websale.de/en/v8s/produkte/gewaehltes-produkt-anzeigen.md)
* Guide: Reuse with includes, to share content between the product page and the PDF template


## Related topics

- [Displaying products on an alternative template](https://dokumentation.websale.de/en/v8s/produkte/produkte-auf-alternativem-template-anzeigen.md)
- [Basics and technology](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/grundlagen-und-technik.md)
- [Template types](https://dokumentation.websale.de/en/v8s/grundlagen-templates/template-typen.md)
- [Materials: subscription module](https://dokumentation.websale.de/en/v8s/materialien/materialien-abo-modul.md)
- [Adding products via voucher](https://dokumentation.websale.de/en/v8s/gutscheine-anbieten/produkte-mittels-gutschein-zusteuern.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.