---
title: "PDF-Link erstellen / Grundsätzliche TypoScript-Frage"
url: "https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage"
source: "typo3.net"
tags: ["TYPO3","TypoScript","Frage","PDF"]
created: "2006-10-20"
last_reply: "2006-10-27"
replies: 6
solved: false
page: 1
pages: 1
lang: "de"
---

# PDF-Link erstellen / Grundsätzliche TypoScript-Frage

TYPO3 › TypoScript · 6 Antworten · gestartet 2006-10-20

## Eröffnungsbeitrag

**el_curtismo** · 2006-10-20 · [Beitrag #1](https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage/1)

Hallo Forum,

dies ist mein erster Post, und ich möchte mich an dieser Stelle für die Mühe aller bedanken, die hier ihr Wissen preisgeben. Es hat mir schon an mancher Stelle viel Mühe erspart :-)

Da ich noch kein allzu versierter TypoScript-Jongleur bin, aber bei einem Problem einfach keine Lösung weiss, hoffe ich, das mir hier jemand helfen kann.

Also:

Bei meiner Seite kann für fast jede Seite eine PDF-Ansicht erstellt werden. Dies mache ich über die Extension pdf_generator2. Dies klappt auch wunderbar, nur der Link oder besser der Dateiname der erstellten PDF ist mein Problem:

```typoscript
temp.linkname = TEXT
temp.linkname.value = Druckansicht-{page:title}.pdf

marks.pdflink = TEXT
marks.pdflink {
  value = Druckansicht
  lang.de = Druckansicht
  postUserFunc = tx_pdfgenerator2->makePdfLink  
  postUserFunc.target = _blank
  postUserFunc.filename < temp.linkname.value
  postUserFunc.attachment = 2
  postUserFunc.ATagParams < marks.link_id
  postUserFunc.include_post_vars = 1
}
```

Die Zeile

```typoscript
postUserFunc.filename < temp.linkname.value
```

ist mein eigentliches Problem. Ich möchte z.B. einen Dateinamen wie Druckansicht-Startseite.pdf erzeugen. Aber das haut so nicht hin. postUserFunc.ATagParams habe ich aber auf gleiche Weise gelöst, da funktioniert es.

Kann mir jemand meinen Denkfehler sagen?

Grüße,

el_curtismo

## Antworten

### [#2](https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage/2) · BastianBalthasarBux · 2006-10-21

was macht er denn im moment?

Da gibts irgendwo die Option 'statisches PDF simulieren' ich glaub bei der Installation!

### [#3](https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage/3) · el_curtismo · 2006-10-23

Hallo,

danke für die Antwort.

Wenn ich das so wie oben beschrieben erstelle, passiert gar nichts, d.h. filename wird überhaupt nicht im Link angezeigt.

Das simulatestaticdocument hatte ich auch ausprobiert. Das hat zwar funktioniert, aber der Dateiname bestand dann nur aus der pid (und .pdf dahinter).

Ich habe mich jetzt erstmal damit beholfen, die Extension zu erweitern. Ist allerdings nicht die Lösung, die ich anstrebe :)

Grüße,

el_curtismo

### [#4](https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage/4) · BastianBalthasarBux · 2006-10-23

naja, mit simulate static document/pdf erstellt er dann den namen aus dem alias. wenn das alias leer ist, nimmt er die uid der seite. --> deswegen verbieten sich rein nummerische aliase von vornherein! ;)

in der pdf extension mal die typoscript settings anschauen, vielleicht kann man konfigurieren wo er den dateinamen hernimmt, da könnte man dann ansetzen mit dem zusammenbasteln.

lg clemens

### [#5](https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage/5) · el_curtismo · 2006-10-24

Hm also das mit dem Alias funktioniert bei mir nicht - wer weiß, wo da schon wieder der Wurm drin ist. Aber danke für den Tip, ich werde da einfach nochmal genauer reinschauen.

Nochmal kurz zur TypoScript-Frage: war der oben von mir gewählte Ansatz grundsätzlich falsch?

Grüße,

el_curtismo

### [#6](https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage/6) · BastianBalthasarBux · 2006-10-24

Naja, die syntax passt, das mit dem filename, weiss nicht, weil ich die user funktion nicht kenne.

> Install additional fonts for PDFlib
>
> If you want to use PDFlib you'll have to install additional fonts. This is most easily done by installing the pdf_generator2_fonts extension. They are packaged separately from the rest to keep the extension sizes manageable.
> Update .htaccess
>
> You will need to update your .htaccess if you want the links to your PDF files be static (i.e. <alias.pdf>). This change is necessary to forward all requests to /<...>.PDF files  to typo3's index.php.
>
> ErrorDocument 404 /error.html
>
> RewriteEngine On
>
> RewriteCond %{REQUEST_FILENAME} !-f
>
> RewriteRule   ^typo3$  /typo3/index_re.php
>
> RewriteRule   ^[^/]*\.html$  index.php
>
> RewriteRule   ^[^/]*\.pdf$  index.php
>
> Available Options
> simulateStaticPdf
>
> This parameter will define whether the link to the PDF files will be a static one (i.e. <alias>.pdf) or dynamic ones (index.php?id=12&type=123). If you enable this you will need to update your .htaccess.
> Disable gzip compression
>
> If this parameter is set and you have gzip-compression turned on for the Frontend ( [FE][compressionLevel] in the installation  tool) the generated PDF's will not be handled by the additional gzip-compression. It is highly recomended to leave this parameter at default (on) since PDF-files incorporate their own compression and you will only gain little additional compression. Additionally you may get problems with browsers that pass the stream to acrobat without decompressing it (e.g. Netscape 4.08-).
> typeID
>
> This parameter defines the typeId that is used for the extension. Normally you will not need to change it.
> Add a link in your Typoscript Template using makePdfLink
>
> To add the a link to the PDF page you can wrap any content element in a link using stdwrap.postUserFunc. The following code gives some examples:
>
> [...]
>
> 100 = IMAGE
>
> 100.file = fileadmin/pdf_link.gif
>
> 100.stdWrap.postUserFunc = tx_pdfgenerator2->makePdfLink
>
> [...]
>
> [...]
>
> 110 = TEXT
>
> 110.value = printable version
>
> 110.postUserFunc = tx_pdfgenerator2->makePdfLink
>
> 110.postUserFunc.target = _blank
>
> [...]
>
> [...]
>
> temp.PDF = TEXT
>
> temp.PDF.value = pdf
>
> temp.PDF.postUserFunc = tx_pdfgenerator2->makePdfLink
>
> temp.PDF.postUserFunc.include_post_vars = 1
>
> page.120 < temp.PRINT
>
> [...]
>
> If  you use the Template Auto-Parser extension and you want to put the link somewhere on your page, you may need to put it in a COA with another element. If you want to place it below the content for example you would change
>
> subparts.content < styles.content.get
>
> to something like
>
> subparts.content = COA
>
> subparts.content {
>
> 10 = CONTENT
>
> 10 < styles.content.get
>
> 20 < temp.PDF
>
> }
>
> and define temp.PDF like above.
>
> Please note that the link will be generated as a USER_INT object by default, i.e. that the link will be generated after the page has been pulled from the cache. If you want to go for maximum performance you can disable that with the parameter postUserFunc.no_user_int = 1 which will generate and cache the link. This is only recommended if you are sure that there are no USER_INT objects on the page that set POST or GET parameters. If you don't understand what i'm writing about leave it at default.
> Add a link in your Typoscript Template using openPdfLink
>
> Altenatively you can also use the function tx_pdfgenerator2->openPdfLink which will generate the opening tag for the link. You will need to generate the closing </a> tag yourself´. Example:
>
> page.36= USER_INT
>
> page.36.userFunc = tx_pdfgenerator2->openPdfLink
>
> page.37=TEXT
>
> page.37.value = Link to PDF
>
> page.38=HTML
>
> page.38.value = </a>
>
> Add a link in your Typoscript Template using getPdfTarget
>
> If you just need the target of the pdf link you can use the function getPdfTarget. Amongst other things this can be useful with  templavoila. Example:
>
> lib.pdflink = USER_INT
>
> lib.pdflink.userFunc = tx_pdfgenerator2->getPdfTarget
>
> lib.pdflink.userFunc.include_post_vars = 1
>
> Customizing the PDF-Page via Typoscript
>
> The PDF is rendered based on a very simple template. You can easily update the pdf_generator page object to contain additional information or content elements on every PDF page. One especially interesting use is to add special HTML comments to control the behavior of the html2pdf conversion. See the html2pdf documentation (on <http://www.tufat.com/docs/html2ps/index.html>) for details. A lot of parameters can be set via the Constant Editor (see next chapter).
>
> You don't have to put any of the following lines into your template, they are already there. They are noted here just for reference purposes.
>
> pdf_generator = PAGEpdf_generator {  typeNum = {$extension.pdf_generator.typeNum}  config.pageGenScript = EXT:pdf_generator/gen_pdf.php  config.admPanel = 0  config.xhtml_cleaning = 0  config.USERNAME_substToken =  config.ftu = 0  config.disableCharsetHeader = 1  config.prefixLocalAnchors = 0  50 = CONTENT  50 < styles.content.get}

<http://typo3.org/documentation/document-library/extension-manuals/pdf_generator2/0.5.0/view/1/3/#id2847388>

einfach mal nachschauen.

### [#7](https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage/7) · el_curtismo · 2006-10-27

Hallo,

sorry das ich mich erst jetzt melde, ich konnte mich ein paar Tage nicht mit dem Thema beschäftigen.

Die Anleitung hatte ich mir auch angeschaut, die Anwort auf meine Frage ging daraus - jedenfalls für mich - nicht hervor :-)

Naja, momentan funktioniert ja alles. Vielen Dank für Deine Mühe!

Grüße,

el_curtismo

---

Quelle: „PDF-Link erstellen / Grundsätzliche TypoScript-Frage“, typo3.net, https://www.typo3.net/d/52035-pdf-link-erstellen-grundsaetzliche-typoscript-frage
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
