Skip to content

Class ZugferdVisualizer

HorstOeko edited this page Dec 28, 2024 · 1 revision

Summary

Class representing the main visualizer class

Methods

fromDocumentReader [static]

Summary

Factory for creating a visualizer by a ZugferdDocumentReader

Signature

public static function fromDocumentReader(
  horstoeko\zugferd\ZugferdDocumentReader $documentReader,
  ?horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract $renderer = null,
): \ZugferdVisualizer
{
}

Parameters

Name Type Allows Null Description
documentReader horstoeko\zugferd\ZugferdDocumentReader
renderer horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract ✔️

Returns

Returns a value of type \ZugferdVisualizer

fromDocumentBuilder [static]

Summary

Factory for creating a visualizer by a ZugferdDocumentReader

Signature

public static function fromDocumentBuilder(
  horstoeko\zugferd\ZugferdDocumentBuilder $documentBuilder,
  ?horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract $renderer = null,
): \ZugferdVisualizer
{
}

Parameters

Name Type Allows Null Description
documentBuilder horstoeko\zugferd\ZugferdDocumentBuilder
renderer horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract ✔️

Returns

Returns a value of type \ZugferdVisualizer

__construct

Caution

Deprecated v2.0.0 Direct call of constructor will be removed in the future. Use static factory methods instead

Summary

Constructor

Signature

public function __construct(
  horstoeko\zugferd\ZugferdDocumentReader $documentReader,
  ?horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract $renderer = null,
): void
{
}

Parameters

Name Type Allows Null Description
documentReader horstoeko\zugferd\ZugferdDocumentReader
renderer horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract ✔️

setRenderer

Summary

Setup the renderer to use for generating markup

Signature

public function setRenderer(
  horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract $renderer,
): void
{
}

Parameters

Name Type Allows Null Description
renderer horstoeko\zugferdvisualizer\contracts\ZugferdVisualizerMarkupRendererContract

setTemplate

Summary

Set the template to use in the specified renderer

Signature

public function setTemplate(string $template): void
{
}

Parameters

Name Type Allows Null Description
template string

setDefaultTemplate

Summary

Sets the built-in template (and switch the markup-rendering engine to the default renderer)

Signature

public function setDefaultTemplate(): void
{
}

addPdfFontDirectory

Summary

Add an additional directory where the PDF-Engine will
search for fonts

Signature

public function addPdfFontDirectory(string $directory): void
{
}

Parameters

Name Type Allows Null Description
directory string

addPdfFontData

Summary

Add a font definition

- Example 1: $visualizer->addPdfFont('frutiger', 'R', 'Frutiger-Normal.ttf')
- Example 2: $visualizer->addPdfFont('frutiger', 'I', 'FrutigerObl-Normal.ttf')

Signature

public function addPdfFontData(string $name, string $style, string $filename): void
{
}

Parameters

Name Type Allows Null Description
name string
style string
filename string

setPdfFontDefault

Summary

Sets the default PDF default font

Signature

public function setPdfFontDefault(string $pdfFontDefault): void
{
}

Parameters

Name Type Allows Null Description
pdfFontDefault string

setPdfPaperSize

Summary

Sets the PDF papersize

Signature

public function setPdfPaperSize(string $pdfPaperSize): void
{
}

Parameters

Name Type Allows Null Description
pdfPaperSize string

setPdfPreInitCallback

Summary

Set the callback which is called before the internal instance
of the PDF-Engine is instanciated

Signature

public function setPdfPreInitCallback(callable $callback): void
{
}

Parameters

Name Type Allows Null Description
callback callable

setPdfRuntimeInitCallback

Summary

Set the callback which is called after the internal instance
of the PDF-Engine is instanciated

Signature

public function setPdfRuntimeInitCallback(callable $callback): void
{
}

Parameters

Name Type Allows Null Description
callback callable

renderMarkup

Summary

Renders the markup (HTML)

Signature

public function renderMarkup(): string
{
}

Returns

Returns a value of type string

renderPdf

Summary

Renders the PDF by markup (HTML) and returns the PDF as a string

Signature

public function renderPdf(): string
{
}

Returns

Returns a value of type string

renderPdfFile

Summary

Renders the PDF by markup (HTML) to a physical file

Signature

public function renderPdfFile(string $toFilename): void
{
}

Parameters

Name Type Allows Null Description
toFilename string