Base

Output PDF data

Namespace: Com\Tecnick\Pdf

Abstract: Yes

File: Base.php line 712

Output PDF data

Tags

  • since: 2002-08-03
  • category: Library
  • author: Nicola Asuni info@tecnick.com
  • copyright: 2002-2026 Nicola Asuni - Tecnick.com LTD
  • license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
  • link: https://github.com/tecnickcom/tc-lib-pdf
  • phpstan-import-type: PageInputData from \Com\Tecnick\Pdf\Page\Box
  • phpstan-import-type: PageData from \Com\Tecnick\Pdf\Page\Box
  • phpstan-import-type: TFontMetric from \Com\Tecnick\Pdf\Font\Stack
  • phpstan-type: TViewerPref array{ ‘HideToolbar’?: bool, ‘HideMenubar’?: bool, ‘HideWindowUI’?: bool, ‘FitWindow’?: bool, ‘CenterWindow’?: bool, ‘DisplayDocTitle’?: bool, ‘NonFullScreenPageMode’?: string, ‘Direction’?: string, ‘ViewArea’?: string, ‘ViewClip’?: string, ‘PrintArea’?: string, ‘PrintClip’?: string, ‘PrintScaling’?: string, ‘Duplex’?: string, ‘PickTrayByPDFSize’?: bool, ‘PrintPageRange’?: array, ‘NumCopies’?: int, }
  • phpstan-type: TBBox array{ ‘x’: float, // left position ‘y’: float, // top position ‘w’: float, // width ‘h’: float, // height }
  • phpstan-type: TStackUnitBBox array<int, TBBox>
  • phpstan-type: TStackTextBBox array<int, TBBox>
  • phpstan-type: TStackCellBBox array<int, TBBox> Cell side values (Top, Right, Bottom, Left) in internal points.
  • phpstan-type: TCellBound array{ ‘T’: float, ‘R’: float, ‘B’: float, ‘L’: float, } Cell definition. The ‘margin’ and ‘padding’ values are expressed in internal points and not in user units: use toPoints() to convert them from the current unit. The setDefaultCellMargin() and setDefaultCellPadding() methods take user units and perform the conversion internally.
  • phpstan-type: TCellDef array{ ‘margin’: TCellBound, ‘padding’: TCellBound, ‘borderpos’: float, }
  • phpstan-type: TRefUnitValues array{ ‘parent’: float, ‘font’: array{ ‘rootsize’: float, ‘size’: float, ‘xheight’: float, ‘zerowidth’: float, }, ‘viewport’: array{ ‘width’: float, ‘height’: float, }, ‘page’: array{ ‘width’: float, ‘height’: float, }, }
  • phpstan-type: TCustomXMP array{ ‘x:xmpmeta’: string, ‘x:xmpmeta.rdf:RDF’: string, ‘x:xmpmeta.rdf:RDF.rdf:Description’: string, ‘x:xmpmeta.rdf:RDF.rdf:Description.pdfaExtension:schemas’: string, ‘x:xmpmeta.rdf:RDF.rdf:Description.pdfaExtension:schemas.rdf:Bag’: string, }
  • phpstan-type: THybridDoc array{ ‘filename’: string, ‘doctype’: string, ‘version’: string, ‘conformance’: string, ‘uri’: string, ‘prefix’: string, ‘schema’: string, }
  • phpstan-type: TXMPProperties list<array{ category: string, description: string, name: string, valueType: string, }>
  • phpstan-type: TPdfUaStructKid array{ type: ’elem’|‘mcid’, id: int, pid?: int, }
  • phpstan-type: TPdfUaStructElem array{ role: string, pid: int, mcids: int[], kids: TPdfUaStructKid[], alt?: string, annots?: int[], attr?: array<string, string>, bbox?: TFourFloat, refpid?: int, required?: bool, }
  • phpstan-type: TFileOptions array{ allowedHosts?: array, maxRemoteSize?: int, curlopts?: array<int, bool|int|string>, defaultCurlOpts?: array<int, bool|int|string>, fixedCurlOpts?: array<int, bool|int|string>, allowedPaths?: array, markupAllowedPaths?: array }
  • phpstan-type: TFourFloat array{ float, float, float, float, }
  • phpstan-type: TAnnotQuadPoint array{ float, float, float, float, float, float, float, float, }
  • phpstan-type: TAnnotBorderStyle array{ ’type’?: string, ‘w’: int, ’s’: string, ’d’?: array, }
  • phpstan-type: TAnnotBorderEffect array{ ’s’?: string, ‘i’?: float, }
  • phpstan-type: TAnnotMeasure array{ ’type’?: string, ‘subtype’?: string, }
  • phpstan-type: TAnnotMarkup array{ ’t’?: string, ‘popup’?: array, ‘ca’?: float, ‘rc’?: string, ‘creationdate’?: string, ‘irt’?: array, ‘subj’?: string, ‘rt’?: string, ‘it’?: string, ’exdata’?: array{ ’type’?: string, ‘subtype’: string, }, }
  • phpstan-type: TAnnotStates array{ ‘marked’?: string, ‘review’?: string, }
  • phpstan-type: TAnnotText array{ ‘subtype’: string, ‘open’?: bool, ’name’?: string, ‘state’?: string, ‘statemodel’?: string, }
  • phpstan-type: TUriAction array{ ’s’: string, ‘uri’: string, ‘ismap’?: bool, }
  • phpstan-type: TAnnotActionDict array{ ’type’?: string, ’s’?: string, ’next’?: array<int, array>, }
  • phpstan-type: TAnnotAdditionalActionDict array{ ’e’?: TAnnotActionDict, ‘x’?: TAnnotActionDict, ’d’?: TAnnotActionDict, ‘u’?: TAnnotActionDict, ‘fo’?: TAnnotActionDict, ‘bi’?: TAnnotActionDict, ‘po’?: TAnnotActionDict, ‘pc’?: TAnnotActionDict, ‘pv’?: TAnnotActionDict, ‘pi’?: TAnnotActionDict, }
  • phpstan-type: TAnnotLink array{ ‘subtype’: string, ‘a’?: TAnnotActionDict, ‘dest’?: string|array, ‘h’?: string, ‘pa’?: TUriAction, ‘quadpoints’?: array<int, TAnnotQuadPoint>, ‘bs’?: TAnnotBorderStyle, }
  • phpstan-type: TAnnotFreeText array{ ‘subtype’: string, ‘da’: string, ‘q’?: int, ‘rc’?: string, ‘ds’?: string, ‘cl’?: array, ‘it’?: string, ‘be’?: TAnnotBorderEffect, ‘rd’?: TFourFloat, ‘bs’?: TAnnotBorderStyle, ’le’?: string, }
  • phpstan-type: TAnnotLine array{ ‘subtype’: string, ’l’: TFourFloat, ‘bs’?: TAnnotBorderStyle, ’le’?: array{ string, string }, ‘ic’?: TFourFloat, ’ll’?: float, ’lle’?: float, ‘cap’?: bool, ‘it’?: string, ’llo’?: float, ‘cp’?: string, ‘measure’?: TAnnotMeasure, ‘co’?: array{ float, float }, }
  • phpstan-type: TAnnotSquare array{ ‘subtype’: string, ‘bs’?: TAnnotBorderStyle, ‘ic’?: TFourFloat, ‘be’?: TAnnotBorderEffect, ‘rd’?: TFourFloat, }
  • phpstan-type: TAnnotCircle TAnnotSquare
  • phpstan-type: TAnnotPolygon array{ ‘subtype’: string, ‘vertices’?: array, ’le’?: array{ string, string }, ‘bs’?: TAnnotBorderStyle, ‘ic’?: TFourFloat, ‘be’?: TAnnotBorderEffect, ‘it’?: string, ‘measure’?: TAnnotMeasure, }
  • phpstan-type: TAnnotPolyline TAnnotPolygon
  • phpstan-type: TAnnotTextMarkup array{ ‘subtype’: string, ‘quadpoints’: array<int, TAnnotQuadPoint>, }
  • phpstan-type: TAnnotCaret array{ ‘subtype’: string, ‘rd’?: TFourFloat, ‘sy’?: string, }
  • phpstan-type: TAnnotRubberStamp array{ ‘subtype’: string, ’name’?: string, }
  • phpstan-type: TAnnotInk array{ ‘subtype’: string, ‘inklist’?: array<int, array>, ‘bs’?: TAnnotBorderStyle, }
  • phpstan-type: TAnnotPopup array{ ‘subtype’: string, ‘parent’?: array, ‘open’?: bool, }
  • phpstan-type: TAnnotFileAttachment array{ ‘subtype’: string, ‘fs’?: string, ’name’?: string, }
  • phpstan-type: TAnnotSound array{ ‘subtype’: string, ‘sound’: string, ’name’?: string, }
  • phpstan-type: TAnnotMovieDict array{ ‘f’: string, ‘aspect’?: array{ float, float }, ‘rotate’?: int, ‘poster’?: bool|string, }
  • phpstan-type: TAnnotMovieActDict array{ ‘start’?: int|string|array{ int|string, int }, ‘duration’?: int|string|array{ int|string, int }, ‘rate’?: float, ‘volume’?: float, ‘showcontrols’?: bool, ‘mode’?: string, ‘synchronous’?: bool, ‘fwscale’?: array{ int, int }, ‘fwposition’?: array{ float, float }, }
  • phpstan-type: TAnnotMovie array{ ‘subtype’: string, ’t’?: string, ‘movie’?: TAnnotMovieDict, ‘a’?: bool|TAnnotMovieActDict, }
  • phpstan-type: TAnnotIconFitDict array{ ‘sw’?: string, ’s’?: string, ‘a’?: array{ float, float }, ‘fb’?: bool, }
  • phpstan-type: TAnnotMKDict array{ ‘r’?: int, ‘bc’?: TFourFloat, ‘bg’?: array{float}, ‘ca’?: string, ‘rc’?: string, ‘ac’?: string, ‘i’?: string, ‘ri’?: string, ‘ix’?: string, ‘if’?: TAnnotIconFitDict, ’tp’?: int, }
  • phpstan-type: TAnnotScreen array{ ‘subtype’: string, ’t’?: string, ‘mk’?: TAnnotMKDict, ‘a’?: TAnnotActionDict, ‘aa’?: TAnnotAdditionalActionDict, }
  • phpstan-type: TAnnotWidget array{ ‘subtype’: string, ‘h’?: string, ‘mk’?: array<array-key, mixed>, ‘a’?: TAnnotActionDict, ‘aa’?: TAnnotAdditionalActionDict, ‘bs’?: TAnnotBorderStyle, ‘parent’?: array, ‘border’?: array, ‘f’?: int, ‘ff’?: int|array<int, int>, ‘dv’?: mixed, ‘v’?: mixed, ‘rv’?: mixed, ’t’?: string, ’tm’?: string, ’tu’?: string, ‘i’?: array, ‘opt’?: array<int, string|array{mixed, string}>, ‘maxlen’?: int, ‘da’?: string, }
  • phpstan-type: TAnnotFixedPrintDict array{ ’type’: string, ‘matrix’?: array{ float, float, float, float, float, float }, ‘h’?: float, ‘v’?: float, }
  • phpstan-type: TAnnotWatermark array{ ‘subtype’: string, ‘fixedprint’?: TAnnotFixedPrintDict, }
  • phpstan-type: TAnnotRedact array{ ‘subtype’: string, ‘quadpoints’?: array<int, TAnnotQuadPoint>, ‘ic’?: TFourFloat, ‘ro’?: string, ‘overlaytext’?: string, ‘repeat’?: bool, ‘da’?: string, ‘q’?: int, }
  • phpstan-type: TAnnotOptsA TAnnotText|TAnnotLink|TAnnotFreeText
  • phpstan-type: TAnnotOptsB TAnnotLine|TAnnotSquare|TAnnotCircle|TAnnotPolygon|TAnnotPolyline
  • phpstan-type: TAnnotOptsC TAnnotTextMarkup|TAnnotCaret|TAnnotRubberStamp|TAnnotInk|TAnnotPopup
  • phpstan-type: TAnnotOptsD TAnnotFileAttachment|TAnnotSound|TAnnotMovie
  • phpstan-type: TAnnotOptsE TAnnotScreen|TAnnotWidget|TAnnotWatermark|TAnnotRedact
  • phpstan-type: TAnnotOpts TAnnotOptsA|TAnnotOptsB|TAnnotOptsC|TAnnotOptsD|TAnnotOptsE
  • phpstan-type: TAnnot array{ ’n’: int, ‘x’: float, ‘y’: float, ‘w’: float, ‘h’: float, ’txt’: string, ‘opt’: TAnnotOpts, }
  • phpstan-type: TGTransparency array{ ‘CS’: string, ‘I’: bool, ‘K’: bool, }
  • phpstan-type: TXOBject array{ ‘spot_colors’: array, ’extgstate’: array, ‘gradient’: array, ‘font’: array, ‘image’: array, ‘xobject’: array, ‘annotations’: array<int, TAnnot>, ’transparency’?: ?TGTransparency, ‘id’: string, ‘outdata’: string, ’n’: int, ‘x’: float, ‘y’: float, ‘w’: float, ‘h’: float, ‘pheight’: float, ‘gheight’: float, }
  • phpstan-type: TPatternObject array{ ‘id’: string, ’n’: int, ‘outdata’: string, ‘bbox’: array{ float, float, float, float }, ‘xstep’: float, ‘ystep’: float, ‘matrix’: array{ float, float, float, float, float, float }, }
  • phpstan-type: TSVGMaskObject array{ ‘id’: string, ‘stream’: string, ‘bbox’: array{ float, float, float, float }, ‘gs_n’: int, }
  • phpstan-type: TOutline array{ ’t’: string, ‘u’: string, ’l’: int, ‘p’: int, ‘x’: float, ‘y’: float, ’s’: string, ‘c’: string, ‘parent’: int, ’last’: int, ‘first’: int, ‘prev’: int, ’next’: int, }
  • phpstan-type: TLtvConfig array{ ’enabled’: bool, ’embed_ocsp’: bool, ’embed_crl’: bool, ’embed_certs’: bool, ‘include_dss’: bool, ‘include_vri’: bool, }
  • phpstan-type: TSignature array{ ‘appearance’: array{ ‘ap’?: string|array<string, string|array<string, string», ‘as’?: string, ’empty’: array<int, array{ ‘objid’: int, ’name’: string, ‘page’: int, ‘rect’: string, ’tu’?: string, }>, ’name’: string, ‘page’: int, ‘rect’: string, ’tu’?: string, ‘xobj’?: string, }, ‘approval’: string, ‘cert_type’: int, ’extracerts’: ?string, ‘info’: array{ ‘ContactInfo’: string, ‘Location’: string, ‘Name’: string, ‘Reason’: string, }, ‘password’: string, ‘privkey’: string, ‘signcert’: string, ‘profile’?: string, ‘digest_algorithm’?: string, ’ltv’?: TLtvConfig, }
  • phpstan-type: TSignTimeStamp array{ ’enabled’: bool, ‘host’: string, ‘username’: string, ‘password’: string, ‘cert’: string, ‘hash_algorithm’: string, ‘policy_oid’: string, ’nonce_enabled’: bool, ’timeout’: int, ‘verify_peer’: bool, ‘allow_sha1’?: bool, }
  • phpstan-type: TUserRights array{ ‘annots’: string, ‘document’: string, ’ef’: string, ’enabled’: bool, ‘form’: string, ‘formex’: string, ‘signature’: string, }
  • phpstan-type: TEmbeddedFile array{ ‘a’: int, ‘f’: int, ’n’: int, ‘file’: string, ‘content’: string, ‘mimeType’: string, ‘afRelationship’: string, ‘description’: string, ‘creationDate’: int, ‘modDate’: int, }
  • phpstan-type: TObjID array{ ‘catalog’: int, ‘dests’: int, ‘doctimestamp’: int, ‘dss’: int, ‘form’: array, ‘info’: int, ‘pages’: int, ‘resdic’: int, ‘signature’: int, ‘srgbicc’: int, ‘outputintenticc’: int, ‘xmp’: int, }
  • phpstan-type: TSignDocPrepared array{ ‘byte_range’: array{ int, int, int, int }, ‘pdfdoc’: string, ‘pdfdoc_length’: int, }
  • SuppressWarnings: (“PHPMD”)

Constants

BORDERPOS_DEFAULT

File: Base.php line 1405

public mixed BORDERPOS_DEFAULT = 0.0

BORDERPOS_EXTERNAL

File: Base.php line 1411

public mixed BORDERPOS_EXTERNAL = -0.5

BORDERPOS_INTERNAL

File: Base.php line 1417

public mixed BORDERPOS_INTERNAL = 0.5

ZEROCELL

File: Base.php line 1436

public TCellDef ZEROCELL = ['margin' => self::ZEROCELLBOUND, 'padding' => self::ZEROCELLBOUND, 'borderpos' => self::BORDERPOS_DEFAULT]

ZEROCELLBOUND

File: Base.php line 1424

public TCellBound ZEROCELLBOUND = ['T' => 0.0, 'R' => 0.0, 'B' => 0.0, 'L' => 0.0]

Properties

$barcode

File: Base.php line 732

public Barcode $barcode

$cache

File: Base.php line 747

public Cache $cache

$color

File: Base.php line 727

public PdfColor $color

$encrypt

File: Base.php line 722

public Encrypt $encrypt

$file

File: Base.php line 737

public File $file

$font

File: Base.php line 773

public Stack $font

$graph

File: Base.php line 768

public Draw $graph

$image

File: Base.php line 778

public Import $image

$markupFile

File: Base.php line 742

public File $markupFile

$page

File: Base.php line 763

public Page $page

$pon

File: Base.php line 1148

public int $pon = 0

$uniconv

File: Base.php line 758

public Convert $uniconv

Methods

defaultFileAllowedPaths()

File: Base.php line 1645

public defaultFileAllowedPaths() : array<string|int, string>

Return values

array<string|int, string>

defaultMarkupAllowedPaths()

File: Base.php line 1655

public defaultMarkupAllowedPaths() : array<string|int, string>

Return values

array<string|int, string>

enableDefaultPageContent()

File: Base.php line 1514

public enableDefaultPageContent([bool $enable = true ]) : void

Parameters

  • $enable : bool = true: Enable or disable the default page content.

getWarnings()

File: Base.php line 1860

public getWarnings() : array<int, string>

The list is filled while the content is written and while the document is serialized, so it is complete only after getOutPDFString() has been called.

Return values

array<int, string>

initClassObjects()

File: Base.php line 2065

public initClassObjects([Encrypt|null $objEncrypt = null ][, TFileOptions|null $fileOptions = null ][, CacheInterface|null $cache = null ]) : void

Parameters

  • $objEncrypt : Encrypt|null = null: Encryption object.
  • $fileOptions : TFileOptions|null = null: Optional configuration for the shared file helper used to load external resources (images, fonts, SVG, etc.). Supported keys: - allowedHosts (string[]): Whitelist of host names that the library is allowed to fetch over HTTP/HTTPS. For security reasons remote URL loading is DISABLED by default; you MUST populate this list (for example [’example.com’, ‘cdn.example.com’]) to enable any remote download. Local file reads are controlled separately by allowedPaths. - maxRemoteSize (int): Maximum size in bytes accepted for a remote download (default 52428800 = 50 MiB). - curlopts (array<int,bool|int|string>): Per-request cURL options merged on top of the defaults (keys are CURLOPT_* constants). - defaultCurlOpts (array<int,bool|int|string>): Replaces the built-in default cURL options. Use with care; omit to keep the safe defaults. - fixedCurlOpts (array<int,bool|int|string>): cURL options that are always enforced and cannot be overridden by curlopts (for example to pin TLS settings). - allowedPaths (string[]): Trusted local path prefixes for file:// reads. Defaults are automatically computed from the package location to cover bundled example assets. - markupAllowedPaths (string[]): Trusted local path prefixes for resources referenced by rendered HTML/CSS/SVG markup. Defaults exclude the system temp directory; when omitted, explicit allowedPaths values are reused for markup too.
  • $cache : CacheInterface|null = null: Optional external cache shared by the cacheable sub-libraries (font subsets, images, …). The application owns the backend, its (de)serialization, expiration and size limits. Null (default) disables external caching.

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception

setPDFVersion()

File: Base.php line 1969

public setPDFVersion([string $version = '1.7' ]) : static

Parameters

  • $version : string = ‘1.7’: PDF document version.

Tags

Return values

static

setRTL()

File: Base.php line 1624

public setRTL(bool $enabled) : static

Parameters

  • $enabled : bool: False = LTR = Left-To-Right; True = RTL = Right-To-Left.

Return values

static

toPoints()

File: Base.php line 1454

public toPoints(float $usr) : float

Parameters

  • $usr : float: Value to convert.

Return values

float

toUnit()

File: Base.php line 1464

public toUnit(float $pnt) : float

Parameters

  • $pnt : float: Value to convert in user units.

Return values

float

toYPoints()

File: Base.php line 1478

public toYPoints(float $usr[, float $pageh = -1 ]) : float

Note: the internal Y points coordinate starts at the bottom left of the page.

Parameters

  • $usr : float: Value to convert.
  • $pageh : float = -1: Optional page height in internal points ($pageh:$this->page->getPage()[‘pheight’]).

Tags

  • throws: Exception

Return values

float

toYUnit()

File: Base.php line 1497

public toYUnit(float $pnt[, float $pageh = -1 ]) : float

Note: the internal Y points coordinate starts at the bottom left of the page.

Parameters

  • $pnt : float: Value to convert.
  • $pageh : float = -1: Optional page height in internal points ($pageh:$this->page->getPage()[‘pheight’]).

Tags

  • throws: Exception

Return values

float