Tcpdf

Tcpdf PDF class

Namespace: Com\Tecnick\Pdf

class Tcpdf extends Output

Extends: Output

Source: src/Tcpdf.php:91

Tcpdf PDF class

Methods

__construct()

Initialize a new PDF object.

public __construct(
    string|Unit $unit = 'mm',
    bool $isunicode = true,
    bool $subsetfont = false,
    bool $compress = true,
    string|PdfConformance $mode = '',
    ?Encrypt $objEncrypt = null,
    TFileOptions|null $fileOptions = null,
    ?CacheInterface $cache = null
)

Parameters:

  • $unit (string|Unit): Unit of measure (‘pt’, ‘mm’, ‘cm’, ‘in’) or a Unit enum case.
  • $isunicode (bool): True if the document is in Unicode mode.
  • $subsetfont (bool): If true subset the embedded fonts to remove the unused characters.
  • $compress (bool): Set to false to disable stream compression.
  • $mode (string|PdfConformance): PDF mode: “pdfa1”, “pdfa2”, “pdfa3”, “pdfx”, “pdfx1a”, “pdfx3”, “pdfx4”, “pdfx5”, “pdfua”, “pdfua1”, “pdfua2”, empty, or a PdfConformance case.
  • $objEncrypt (?Encrypt): Encryption object. Ignored in PDF/A mode, which forbids encryption.
  • $fileOptions (TFileOptions|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 paths are not affected.
    • 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.
  • $cache (?CacheInterface): Optional external cache reused by every cacheable sub-library (font subsets, images, …). Implement Com\Tecnick\Pdf\Cache\CacheInterface to bridge your own backend (filesystem, APCu, Redis, PSR-16, …); the application owns the backend, its (de)serialization, expiration and size limits. Null (default) disables external caching. No backend is shipped.

Throws:

Source: src/Tcpdf.php:150

addEmptySignatureAppearance()

Add an empty digital signature appearance (a clickable rectangle area to get signature properties).

public addEmptySignatureAppearance(
    float $posx = 0,
    float $posy = 0,
    float $width = 0,
    float $height = 0,
    int $page = -1,
    string $name = '',
    string $description = ''
): void

Parameters:

  • $posx (float): Abscissa of the upper-left corner.
  • $posy (float): Ordinate of the upper-left corner.
  • $width (float): Width of the signature area.
  • $height (float): Height of the signature area.
  • $page (int): optional page number (if < 0 the current page is used).
  • $name (string): Name of the signature.
  • $description (string): Description of the field, written as /TU in a tagged mode.

Throws:

  • Exception: Also available through the fluent API: signature()->emptyField().

Source: src/Tcpdf.php:1130

addPage()

Add a new page (wrapper function for $this->page->add()).

public addPage(array $data = = '[]'): array<string,mixed>

Parameters:

  • $data (array)

Returns: array<string,mixed>

addPageFromImport()

Add a new page sized to match an imported template and place the template filling the page.

public addPageFromImport(
    string $sourceId,
    int $pageNum,
    array<string,mixed> $options = []
): PageTemplateInterface

Parameters:

  • $sourceId (string): Source document identifier.
  • $pageNum (int): 1-based page number.
  • $options (array<string,mixed>): Import options (same as importPage).

Returns: PageTemplateInterface: The imported page template.

Throws:

Source: src/Tcpdf.php:1737

addTextCell()

Adds a text block inside a rectangular cell using relative coordinates.

public addTextCell(
    string $txt,
    int $pid = = '-1',
    float $posx = = '0',
    float $posy = = '0',
    float $width = = '0',
    float $height = = '0',
    float $offset = = '0',
    float $linespace = = '0',
    string $valign = = '\'T\'',
    string $halign = = '\'\'',
    ?array $cell = = 'null',
    array $styles = = '[]',
    float $strokewidth = = '0',
    float $wordspacing = = '0',
    float $leading = = '0',
    float $rise = = '0',
    bool $jlast = = 'true',
    bool $fill = = 'true',
    bool $stroke = = 'false',
    bool $underline = = 'false',
    bool $linethrough = = 'false',
    bool $overline = = 'false',
    bool $clip = = 'false',
    bool $drawcell = = 'true',
    string $forcedir = = '\'\'',
    ?array $shadow = = 'null',
    string $fit = = '\'\''
): void

Parameters:

  • $txt (string)
  • $pid (int)
  • $posx (float)
  • $posy (float)
  • $width (float)
  • $height (float)
  • $offset (float)
  • $linespace (float)
  • $valign (string)
  • $halign (string)
  • $cell (?array)
  • $styles (array)
  • $strokewidth (float)
  • $wordspacing (float)
  • $leading (float)
  • $rise (float)
  • $jlast (bool)
  • $fill (bool)
  • $stroke (bool)
  • $underline (bool)
  • $linethrough (bool)
  • $overline (bool)
  • $clip (bool)
  • $drawcell (bool)
  • $forcedir (string)
  • $shadow (?array)
  • $fit (string)

addTOC()

Add a Table of Contents (TOC) to the document.

The bookmarks are created via the setBookmark() method.

public addTOC(
    int $page = -1,
    float $posx = 0,
    float $posy = 0,
    float $width = 0,
    bool $rtl = false,
    StyleDataOpt $linestyle = ['lineWidth' => 0.3, 'lineCap' => 'butt', 'lineJoin' => 'mit…
): void

Parameters:

  • $page (int): Page number.
  • $posx (float): Abscissa of the upper-left corner.
  • $posy (float): Ordinate of the upper-left corner.
  • $width (float): Width of the TOC area.
  • $rtl (bool): Right-To-Left - If true prints the TOC in RTL mode.
  • $linestyle (StyleDataOpt): Line style for the space filler.

Throws:

Source: src/Tcpdf.php:1270

appendDocument()

Append all pages (or a range) from a source document, each on its own new page.

The caller’s current page context (active page, graph dimensions) is preserved so document flow can continue on the same page after the call returns.

public appendDocument(
    string $sourceId,
    int[]|null $range = null,
    array<string,mixed> $options = []
): array<int,PageTemplateInterface>

Parameters:

  • $sourceId (string): Source document identifier.
  • $range (int[]|null): 1-based page numbers to import, or null for all pages.
  • $options (array<string,mixed>): Import options (same as importPage).

Returns: array<int,PageTemplateInterface>: One PageTemplateInterface per appended page.

Throws:

Source: src/Tcpdf.php:1771

applyExternalSignature()

Inject an externally generated CMS/PKCS#7 signature into a prepared document.

public applyExternalSignature(
    string $preparedPdf,
    array{int, int, int, int} $byteRange,
    string $signature,
    string|ExternalSignatureEncoding $encoding = 'binary'
): string

Parameters:

  • $preparedPdf (string): Prepared PDF returned by getExternalSignaturePreparation().
  • $byteRange (array{int, int, int, int}): ByteRange returned by getExternalSignaturePreparation().
  • $signature (string): External signature data.
  • $encoding (string|ExternalSignatureEncoding): Signature encoding: binary, base64, hex, or enum case.

Returns: string: Fully signed PDF document.

Throws:

  • Exception: Also available through the fluent API: signature()->external()->apply().

Source: src/Tcpdf.php:802

closeLayer()

Close the current optional content (layer) marked-content sequence.

public closeLayer(): string

Returns: string: PDF marked-content operator that ends the layer opened by newLayer().

Source: src/Tcpdf.php:1243

defaultPageContent()

Sets the page common content like Header and Footer.

public defaultPageContent(int $pid = = '-1'): string

Parameters:

  • $pid (int)

Returns: string

getBarcode()

Get a barcode PDF code.

public getBarcode(
    string $type,
    string $code,
    float $posx = 0,
    float $posy = 0,
    int $width = -1,
    int $height = -1,
    array{int, int, int, int} $padding = [0, 0, 0, 0],
    StyleDataOpt $style = []
): string

Parameters:

  • $type (string): Barcode type.
  • $code (string): Barcode content.
  • $posx (float): Abscissa of upper-left corner.
  • $posy (float): Ordinate of upper-left corner.
  • $width (int): Barcode width in user units (excluding padding). A negative value indicates the multiplication factor for each column.
  • $height (int): Barcode height in user units (excluding padding). A negative value indicates the multiplication factor for each row.
  • $padding (array{int, int, int, int}): Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the multiplication factor for each row or column.
  • $style (StyleDataOpt): Array of style options.

Returns: string

Throws:

Source: src/Tcpdf.php:524

getExternalSignaturePreparation()

Build the document for external signing and compute the digest over ByteRange data.

public getExternalSignaturePreparation(string $algorithm = 'sha256'): array{algorithm: string, byte_range: array{int, int, int, int}, prepared_pdf: string, hash_raw: string, hash_hex: string, hash_base64: string}

Parameters:

  • $algorithm (string): Hash algorithm accepted by hash() (default: sha256).

Returns: array{algorithm: string, byte_range: array{int, int, int, int}, prepared_pdf: string, hash_raw: string, hash_hex: string, hash_base64: string}

Throws:

  • Exception
  • Throwable: Also available through the fluent API: signature()->external()->prepare().

Source: src/Tcpdf.php:750

getLastBBox()

Returns the last text fragment bounding box as {x, y, w, h} (left, top, width, height).

public getLastBBox(): array<string,mixed>

Returns: array<string,mixed>

getPDFFilename()

Return the PDF document base file name currently in use.

The value may differ from the argument passed to setPDFFilename(), which sanitizes names outside the accepted set.

public getPDFFilename(): string

Returns: string

Source: src/Tcpdf.php:361

getSignatureObjectID()

Get the signature widget object ID.

public getSignatureObjectID(): int

Returns: int: Signature widget annotation object ID (0 if not initialized).

Also available through the fluent API: signature()->widgetObjectId().

Source: src/Tcpdf.php:853

getSourcePageCount()

Return the total number of pages in a registered source document.

The count reflects the pages actually reachable through the /Kids page tree; the declared /Count entry of the /Pages dictionary is ignored.

public getSourcePageCount(string $sourceId): int

Parameters:

  • $sourceId (string): Source document identifier.

Returns: int: Total page count.

Throws:

Source: src/Tcpdf.php:1567

importPage()

Import one page from a registered source document and return a PageTemplateInterface.

public importPage(string $sourceId, int $pageNum, array<string,mixed> $options = []): PageTemplateInterface

Parameters:

  • $sourceId (string): Source document identifier.
  • $pageNum (int): 1-based page number.
  • $options (array<string,mixed>): Import options.

Returns: PageTemplateInterface: Imported page template ready for placement.

Throws:

Source: src/Tcpdf.php:1585

importPages()

Import all pages (or a range) from a registered source document.

public importPages(
    string $sourceId,
    int[]|null $range = null,
    array<string,mixed> $options = []
): array<int,PageTemplateInterface>

Parameters:

  • $sourceId (string): Source document identifier.
  • $range (int[]|null): 1-based page numbers to import, or null for all pages.
  • $options (array<string,mixed>): Import options (same as importPage).

Returns: array<int,PageTemplateInterface>: One PageTemplateInterface per requested page.

Throws:

Source: src/Tcpdf.php:1715

initClassObjects()

Initialize dependencies class objects.

public initClassObjects(
    ?Encrypt $objEncrypt = = 'null',
    ?array $fileOptions = = 'null',
    ?CacheInterface $cache = = 'null'
): void

Parameters:

newLayer()

Creates and return a new PDF Layer.

public newLayer(
    string $name = '',
    array{'view'?: bool, 'design'?: bool} $intent = [],
    bool $print = true,
    bool $view = true,
    bool $lock = true
): string

Parameters:

  • $name (string): Layer name (only a-z letters and numbers). Leave empty for automatic name.
  • $intent (array{‘view’?: bool, ‘design’?: bool}): intended use of the graphics in the layer.
  • $print (bool): Set the printability of the layer.
  • $view (bool): Set the visibility of the layer.
  • $lock (bool): Set the lock state of the layer.

Returns: string

Throws:

  • Exception: if the active conformance mode forbids optional content.

Source: src/Tcpdf.php:1200

setDisplayMode()

Defines the way the document is to be displayed by the viewer.

public setDisplayMode(
    int|string|DisplayZoom $zoom = 'default',
    string|PageLayout $layout = 'SinglePage',
    string|PageDisplayMode $mode = 'UseNone'
): static

Parameters:

  • $zoom (int|string|DisplayZoom): The zoom to use (or a DisplayZoom enum case). It can be one of the following string values or a number indicating the zooming factor to use.
    • fullpage: displays the entire page on screen * fullwidth: uses maximum width of window
    • real: uses real size (equivalent to 100% zoom) * default: uses viewer default mode
  • $layout (string|PageLayout): The page layout (or a PageLayout enum case). Possible values are:
    • SinglePage Display one page at a time
    • OneColumn Display the pages in one column
    • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
    • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
    • TwoPageLeft Display the pages two at a time, with odd-numbered pages on the left
    • TwoPageRight Display the pages two at a time, with odd-numbered pages on the right
  • $mode (string|PageDisplayMode): A name object (or PageDisplayMode enum case) for how the document is displayed:
    • UseNone Neither document outline nor thumbnail images visible
    • UseOutlines Document outline visible
    • UseThumbs Thumbnail images visible
    • FullScreen Full screen, with no menu bar, window controls, or any other window visible
    • UseOC (PDF 1.5) Optional content group panel visible
    • UseAttachments (PDF 1.6) Attachments panel visible

Returns: static

Source: src/Tcpdf.php:485

setImportSourceData()

Register a source PDF from raw binary data.

public setImportSourceData(string $data, array<string,mixed> $cfg = []): string

Parameters:

  • $data (string): Raw PDF binary data.
  • $cfg (array<string,mixed>): Optional parser configuration: ‘ignore_filter_errors’, ‘decode_streams’, ‘max_stream_size’, ‘max_resolution_depth’, ‘max_nesting_depth’ and ‘strict_limits’.

Returns: string: Source document identifier.

Throws:

Source: src/Tcpdf.php:1548

setImportSourceFile()

Register a source PDF file for import.

public setImportSourceFile(string $path, array<string,mixed> $cfg = []): string

Parameters:

  • $path (string): File path to a readable PDF.
  • $cfg (array<string,mixed>): Optional parser configuration: ‘ignore_filter_errors’, ‘decode_streams’, ‘max_stream_size’, ‘max_resolution_depth’, ‘max_nesting_depth’ and ‘strict_limits’.

Returns: string: Source document identifier.

Throws:

Source: src/Tcpdf.php:1528

setLanguage()

Sets the document language code (PDF Catalog /Lang entry), for example ’en-US’ or ‘it-IT’.

public setLanguage(string $code): void

Parameters:

  • $code (string): Language code (RFC 3066 / BCP 47).

Source: src/Tcpdf.php:306

setLanguageArray()

Sets the language array used for document metadata (for example the ‘a_meta_language’ entry that maps to the PDF Catalog /Lang key).

public setLanguageArray(array<string,string> $lang): void

Parameters:

  • $lang (array<string,string>): Associative array of language entries.

Source: src/Tcpdf.php:295

setPageContext()

public setPageContext(int $pid = = '-1'): void

Parameters:

  • $pid (int)

setPageTransparencyGroup()

Controls emission of the per-page transparency /Group entry (/Group << /Type /Group /S /Transparency /CS /DeviceRGB ») on standard (non PDF/A) pages.

Modes:

  • ‘auto’ : (default) emit the group only on pages that use transparency (a fill/stroke alpha below 1, a non-Normal blend mode, a soft mask, a soft-masked image, an imported page, or a referenced transparency-group XObject).
  • ‘always’ : emit the group on every standard page.
  • ’never’ : never emit the group; blending becomes implementation-defined.

Has no effect in PDF/A mode, where the group is already suppressed.

public setPageTransparencyGroup(string|TransparencyGroupMode $mode = 'auto'): static

Parameters:

  • $mode (string|TransparencyGroupMode): One of ‘auto’, ‘always’, ’never’, or a TransparencyGroupMode case.

Returns: static

Throws:

Source: src/Tcpdf.php:439

setPDFFilename()

Set the PDF document base file name.

Accepted base names may contain Unicode letters, marks, numbers, underscore (_), comma (,), space, and hyphen (-), and include at least one letter or number. The base name is normalized to Unicode NFC before it is checked. The filename length is limited to 255 bytes. If a file extension is present, it must be ‘.pdf’ (case-insensitive). Any directory path is ignored and only the basename is used. Names outside that set are sanitized by sanitizePDFFilename(), so the name in use may differ from $name: see getPDFFilename(). Sanitization is not injective: ‘a.b.pdf’ and ‘a_b.pdf’ both yield ‘a_b.pdf’.

public setPDFFilename(string $name): void

Parameters:

  • $name (string): File name.

Source: src/Tcpdf.php:337

setSignature()

Enable document signature (requires the OpenSSL Library).

The digital signature improve document authenticity and integrity and allows to enable extra features on PDF Reader.

To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12 To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes

public setSignature(TSignature $data): void

Parameters:

  • $data (TSignature): Signature data: - appearance (array) Signature appearance. - ap (string|array) Optional annotation appearance stream definition (/AP). Same format as generic annotation appearances: keyed by mode (n/r/d), each mode accepting either a stream string or a state=>stream map. - as (string) Optional annotation appearance state (/AS). - empty (bool) Array of empty signatures: - objid (int) Object id. - name (string) Name of the signature field. - page (int) Page number. - rect (array) Rectangle of the signature field. - name (string) Name of the signature field. - page (int) Page number. - rect (array) Rectangle of the signature field. - xobj (string) Optional Form XObject ID to auto-fit as normal appearance. - approval (string) Set to ‘A’ to enable the approval signature eg. for PDF incremental update. - cert_type (int) The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature. - extracerts (string) Specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used. - info (array) Optional information. - ContactInfo (string) - Location (string) - Name (string) - Reason (string) - password (string) - privkey (string) Private key (string or filename prefixed with ‘file://’). - signcert (string) Signing certificate (string or filename prefixed with ‘file://’). - ltv (array) LTV collection options. - enabled (bool) Enable validation material collection. - embed_ocsp (bool) Allow OCSP material collection. - embed_crl (bool) Allow CRL material collection. - embed_certs (bool) Embed certificate bytes in validation material. - include_dss (bool) Include DSS objects in output. - include_vri (bool) Include VRI map in output.

    Also available through the fluent API: signature()->configure().

Throws:

Source: src/Tcpdf.php:646

setSignatureAppearance()

Set the digital signature appearance (a clickable rectangle area to get signature properties).

public setSignatureAppearance(
    float $posx = 0,
    float $posy = 0,
    float $width = 0,
    float $height = 0,
    int $page = -1,
    string $name = ''
): void

Parameters:

  • $posx (float): Abscissa of the upper-left corner.
  • $posy (float): Ordinate of the upper-left corner.
  • $width (float): Width of the signature area.
  • $height (float): Height of the signature area.
  • $page (int): optional page number (if < 0 the current page is used).
  • $name (string): Name of the signature.

Throws:

  • Exception: Also available through the fluent API: signature()->appearance()->place().

Source: src/Tcpdf.php:1021

setSignatureAppearanceDescription()

Set the description of the signature field, written as the /TU and /Contents entries of the widget annotation in a tagged mode.

Without it the field name is used, which is an identifier rather than the description a screen reader is expected to read.

public setSignatureAppearanceDescription(string $description): void

Parameters:

  • $description (string): Human readable description of the signature field.

    Also available through the fluent API: signature()->appearance()->description().

Source: src/Tcpdf.php:1110

setSignatureAppearanceStream()

Set a custom appearance stream for the signature widget annotation.

public setSignatureAppearanceStream(
    string $stream,
    string|SignatureAppearanceMode $mode = 'N',
    string $state = ''
): void

Parameters:

  • $stream (string): Appearance stream content.
  • $mode (string|SignatureAppearanceMode): Appearance mode: N (normal), R (rollover), D (down), or enum case.
  • $state (string): Optional appearance state name.

Throws:

  • Exception: Also available through the fluent API: signature()->appearance()->stream().

Source: src/Tcpdf.php:1047

setSignatureAppearanceXObject()

Set a Form XObject ID as signature widget appearance source.

The XObject will be auto-fitted to the signature rectangle.

public setSignatureAppearanceXObject(string $xobjid): void

Parameters:

  • $xobjid (string): XObject resource name (for example “IMP1”).

Throws:

  • Exception: Also available through the fluent API: signature()->appearance()->xobject().

Source: src/Tcpdf.php:1089

setSignatureForExternalSigning()

Enable a signature placeholder for a remote signing workflow.

This reserves the signature widget and placeholder bytes without requiring a local private key. The actual CMS/PKCS#7 value can be embedded later with applyExternalSignature().

public setSignatureForExternalSigning(TSignature $data): void

Parameters:

Throws:

  • Exception: Also available through the fluent API: signature()->external()->configure().

Source: src/Tcpdf.php:718

setSignTimeStamp()

Set the signature timestamp.

public setSignTimeStamp(TSignTimeStamp $data): void

Parameters:

  • $data (TSignTimeStamp): Signature timestamp data:
    • enabled (bool) If true enable timestamp signature.
    • host (string) Time Stamping Authority (TSA) server (prefixed with ‘https://’)
    • username (string) TSA username or authorization PEM file.
    • password (string) TSA password.
    • cert (string) cURL optional location of TSA certificate for authorization.
    • hash_algorithm (string) Digest algorithm: sha256, sha384, sha512.
    • policy_oid (string) Optional timestamp policy OID.
    • nonce_enabled (bool) Add nonce to the timestamp request.
    • timeout (int) Request timeout in seconds.
    • verify_peer (bool) Validate TSA TLS certificate.
    • allow_sha1 (bool) Accept a token that uses SHA-1 for its signature, its message digest, or its ESS signing-certificate attribute. Off by default; needed by a TSA that still emits the RFC 2634 signing-certificate (v1) attribute, which is SHA-1 by definition.

Throws:

  • Exception: Also available through the fluent API: signature()->timestamp().

Source: src/Tcpdf.php:893

setSpaceRegexp()

No-op kept for API compatibility.

Word separators are resolved from the Unicode Bidi class of each code point by the font layer, so no configurable pattern is involved.

public setSpaceRegexp(string $regexp = ''): void

Parameters:

  • $regexp (string): Ignored.

Source: src/Tcpdf.php:415

setUserRights()

Set User’s Rights for the PDF Reader.

WARNING: This is experimental and currently doesn’t work because requires a private key. Check the PDF Reference 8.7.1 Transform Methods, Table 8.105 Entries in the UR transform parameters dictionary.

public setUserRights(TUserRights $rights): void

Parameters:

  • $rights (TUserRights): User rights: - annots (string) Names specifying additional annotation-related usage rights for the document. Valid names in PDF 1.5 and later are /Create/Delete/Modify/Copy/Import/Export, which permit the user to perform the named operation on annotations. - document (string) Names specifying additional document-wide usage rights for the document. The only defined value is “/FullSave”, which permits a user to save the document along with modified form and/or annotation data. - ef (string) Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files Names specifying additional embedded-files-related usage rights for the document. - enabled (bool) If true enable user’s rights on PDF reader. - form (string) Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate. - formex (string) Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode. - signature (string) Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field.

    Also available through the fluent API: signature()->userRights().

Source: src/Tcpdf.php:582

signature()

Fluent entry point for the signature subsystem.

Groups signature configuration, timestamp, user rights, appearance, empty fields and external signing behind one object, forwarding to the underlying setSignature() / setSignTimeStamp() / … methods.

public signature(): Facade

Returns: Facade

Source: src/Tcpdf.php:1481

toPoints()

Convert user units to internal points unit.

public toPoints(float $usr): float

Parameters:

  • $usr (float)

Returns: float

toUnit()

Convert internal points to user unit.

public toUnit(float $pnt): float

Parameters:

  • $pnt (float)

Returns: float

toYUnit()

Convert vertical internal points value to user unit.

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

Parameters:

  • $pnt (float)
  • $pageh (float)

Returns: float

upgradeSignatureToLta()

Request a PAdES B-LTA archive: switch the signature profile to pades-b-lta and ensure the long-term validation store (DSS) is emitted.

The next getOutPDFString() then produces the signature revision, the DSS revision, and a /Type /DocTimeStamp archive-timestamp revision. A TSA must be configured (setSignTimeStamp / signature()->timestamp()) since B-LTA builds on B-T; without it the timestamp revision is skipped. Existing LTV options are preserved; only enabled and include_dss are forced on.

public upgradeSignatureToLta(): void

Source: src/Tcpdf.php:951

useImportedPage()

Place an imported page template onto the current page.

public useImportedPage(
    PageTemplateInterface $tpl,
    float $xpos,
    float $ypos,
    float|null $width = null,
    float|null $height = null,
    array<string,mixed> $options = []
): array{x: float, y: float, width: float, height: float}

Parameters:

  • $tpl (PageTemplateInterface): Template to place.
  • $xpos (float): X position in user units.
  • $ypos (float): Y position in user units.
  • $width (float|null): Target width (null = use template width).
  • $height (float|null): Target height (null = use template height).
  • $options (array<string,mixed>): Placement options.

Returns: array{x: float, y: float, width: float, height: float}: Actual placed rect in user units.

Throws:

Source: src/Tcpdf.php:1605

Inherited members

From Base

From Cell

From CSS

From HTML

From JavaScript

From MetaInfo

From Output

From SVG

  • addSVG(): Add a new SVG image and return its object ID.
  • getSetSVG(): Get the PDF output string to print the specified SVG object.

From Text