Configuration Reference

Technical information: Installation, Reference of TypoScript options and how to extend it.

Target group: Developers

Installation

Install the extension using the extension manager and include the static TypoScript template of the extension.

TypoScript Reference

Settings inheritance

To avoid redundancy there is an inheritance structure within the settings. There are basically three levels top down:

  1. plugin.tx_pdfviewhelpers.settings.document|page|generalText:

The top level are global settings for document, page and generalText (all textual output).

  1. plugin.tx_pdfviewhelpers.settings.headline|text|list:

Headline, text and list inherit settings from generalText. All the settings from generalText may be overwritten here with specific settings.

  1. Fluid ViewHelper attributes:

The bottom level are Fluid ViewHelper attributes. All settings for document, page, headline, text and list may be overwritten using Fluid ViewHelper attributes with the same name. e.g:

{namespace pdf=Bithost\Pdfviewhelpers\ViewHelpers}

<pdf:document outputDestination="I" title="Bithost Example">
        <pdf:page autoPageBreak="1">
                <pdf:headline color="#333">Different color</pdf:headline>
        </pdf:page>
</pdf:document>

Properties in plugin.tx_pdfviewhelpers.settings

Property Data type Default
config.class string Bithost\Pdfviewhelpers\Model\EmptyTCPDF
config.language string ger
config.disableCache boolean 1
config.jpgQuality integer 100
config.allowedImageTypes Array See static TypoScript template
document.title string Default document title
document.subject string Autogenerated PDF, By Bithost GmbH
document.author string Bithost GmbH
document.keywords string  
document.creator string TYPO3 EXT:pdfviewhelpers
document.outputDestination string I
document.outputPath string document.pdf
page.autoPageBreak boolean 0
page.margins Array {top: 15, right: 15, bottom: 15, left: 15}
generalText.trim boolean 1
generalText.color string #000
generalText.fontFamily string helvetica
generalText.fontSize integer 11
generalText.padding Array {top: 0, right: 0, bottom: 0, left: 0}
generalText.alignment string left
generalText.paragraphSpacing integer 2
text.color. string See generalText
text.fontFamily string See generalText
text.fontSize integer See generalText
text.padding Array See generalText
text.alignment string See generalText
text.paragraphSpacing integer See generalText
headline.color string See generalText
headline.fontFamily string See generalText
headline.fontSize integer See generalText
headline.padding Array See generalText
headline.alignment string See generalText
headline.paragraphSpacing integer See generalText
list.color string See generalText
list.fontFamily string See generalText
list.fontSize integer See generalText
list.padding Array See generalText
list.alignment string See generalText
list.paragraphSpacing integer See generalText
list.bulletColor string #000
list.bulletImageSrc string  
list.bulletSize data-type-float 1.5

Property details

config.class

plugin.tx_pdfviewhelpers.settings.config.class = string

Decides which PHP class should be used as TCPDF object. The class must inherit from \TCPDF. If this setting is left empty \TCPDF is used as class. There are two other possibilities shipped with this extension:

  • Bithost\Pdfviewhelpers\Model\EmptyTCPDF: renders empty headers and footers
  • Bithost\Pdfviewhelpers\Model\BithostTCPDF: renders headers belonging to the example

You can easily provide your own class in order to render custom header and footers or to customize TCPDF in any way.

config.language

plugin.tx_pdfviewhelpers.settings.config.language = string

Decides which language settings are used from TCPDF. All possible language codes can be found in Resources/Private/tcpdf/examples/lang/.

config.disableCache

plugin.tx_pdfviewhelpers.settings.config.disableCache = boolean

Decides whether the TYPO3 frontend cache will be disabled or not.

config.jpgQuality

plugin.tx_pdfviewhelpers.settings.config.jpgQuality = integer

JpgQuality being used, values from 0 - 100.

config.allowedImageTypes

plugin.tx_pdfviewhelpers.settings.config.allowedImageTypes = Array

Mapping of TCPDF image functions to their corresponding image file extensions.

document.title

plugin.tx_pdfviewhelpers.settings.document.title = string

The title of the generated PDF document.

document.subject

plugin.tx_pdfviewhelpers.settings.document.subject = string

The subject of the generated PDF document.

document.author

plugin.tx_pdfviewhelpers.settings.document.author = string

The author of the generated PDF document.

document.keywords

plugin.tx_pdfviewhelpers.settings.document.keywords = string

A comma separated list of keywords for the generated PDF document.

document.creator

plugin.tx_pdfviewhelpers.settings.document.creator = string

The creator of the generated PDF document.

document.outputDestination

plugin.tx_pdfviewhelpers.settings.document.outputDestination = string

The TCPDF output destination for the PDF. Possible values are:

outputDestination Description
I Sending the PDF inline to the browser.
D Sending the PDF as immediate file download.
F Saving the PDF to the specified outputPath.
FI Saving the PDF to the specified outputPath and sending it inline to the browser.
FD Saving the PDF to the specified outputPath and sending it as immediate file download.
E Return the PDF as base64 mime multi-part email attachment (RFC 2045).
S Return the PDF as string.

document.outputPath

plugin.tx_pdfviewhelpers.settings.document.outputPath = string

The TCPDF output path of the document. If you are saving the file to filesystem this is a relative path from the webroot directory e.g. fileadmin/pdfviewhelpers/projectXY.pdf. If you are sending it inline or as file download it is simply the name of the document e.g. projectXY.pdf.

page.autoPageBreak

plugin.tx_pdfviewhelpers.settings.page.autoPageBreak = boolean

Decides whether TCPDF uses auto page break or not. You can always add a new page by adding a new <pdf:page> tag to your template.

page.margins

plugin.tx_pdfviewhelpers.settings.page.margins = Array

An array of the margins for each page.

generalText.trim

plugin.tx_pdfviewhelpers.settings.generalText.trim = boolean

If set to true leading and trailing spaces or tabs are trimmed.

generalText.color

plugin.tx_pdfviewhelpers.settings.generalText.color = string

The text color as hex value, possible syntax are: #000 or #000000

generalText.fontFamily

plugin.tx_pdfviewhelpers.settings.generalText.fontFamily = string

The font family being used. You can add your own fonts using your own TCPDF class.

generalText.fontSize

plugin.tx_pdfviewhelpers.settings.generalText.fontSize = integer

The font size being used.

generalText.padding

plugin.tx_pdfviewhelpers.settings.generalText.padding = Array

An array of the padding for each text element.

generalText.alignment

plugin.tx_pdfviewhelpers.settings.generalText.alignment = string

Possible values are: ‘left’, ‘center’, ‘right’, ‘justify’

generalText.paragraphSpacing

plugin.tx_pdfviewhelpers.settings.generalText.paragraphSpacing = integer

Defines the spacing of paragraphs separated by new lines.

list.bulletColor

plugin.tx_pdfviewhelpers.settings.list.bulletColor = string

The color of the bullet used as hex value, possible syntax are: #000 or #000000

list.bulletImageSrc

plugin.tx_pdfviewhelpers.settings.list.bulletImageSrc = string

The path to an image that should be used as bullet.

list.bulletSize

plugin.tx_pdfviewhelpers.settings.list.bulletSize = data-type-float

The size of the bullet as floating point value.

Advanced Customization

You can add custom headers and footers to all pages by providing your own TCPDF class. The more you can customize TCPDF in any way you like using your own class. E.g. you could load your own font within the constructor.

See plugin.tx_pdfviewhelpers.settings.config.class

If there is a ViewHelper missing, feel free to implement your own ViewHelper extending the AbstractContentElementViewHelper from the extension. You can have a look at the ViewHelpers in Classes/ViewHelpers. If you feel like your ViewHelper might be useful for everybody, feel free to create a pull request!

Caching

The extension pdfviewhelpers does not provide any caching mechanism for the generated PDF documents. In fact caching is disabled by default because it makes not much sense to save a PDF document to the TYPO3 frontend cache. Since generating PDF documents is quite time consuming you should implement your own caching strategy by saving the generated PDF files to the filesystem and only generate them when necessary.