MetaInfo

Meta Information PDF class

Namespace: Com\Tecnick\Pdf

abstract class MetaInfo extends HTML

Extends: HTML

Source: src/MetaInfo.php:72

Meta Information PDF class

Methods

getVersion()

Return the program version.

public getVersion(): string

Returns: string

Source: src/MetaInfo.php:176

setAuthor()

Defines the author of the document.

An empty string removes the entry.

public setAuthor(string $author): static

Parameters:

  • $author (string): The name of the author.

Returns: static

Source: src/MetaInfo.php:202

setCreator()

Defines the creator of the document.

This is typically the name of the application that generates the PDF.

An empty string removes the entry.

public setCreator(string $creator): static

Parameters:

  • $creator (string): The name of the creator.

Returns: static

Source: src/MetaInfo.php:189

setCustomXMP()

Set additional custom XMP data to be appended just before the end of the tag indicated by the key.

Repeated calls with the same key append to the previously stored fragments, separated by a newline. Pass $replace to overwrite them instead; an empty $xmp with $replace clears the key.

The fragment is checked for XML well-formedness in the namespace context of the insertion point (see CUSTOMXMPNS). A fragment using any other prefix must declare it on its own root element: the ‘rdf:Description’ keys inject into the PDF/A extension schema description, where only three prefixes are in scope. DOCTYPE and ENTITY declarations are rejected.

public setCustomXMP(string $key, string $xmp, bool $replace = false): static

Parameters:

  • $key (string): Key for the custom XMP data. Valid keys are:
    • ‘x:xmpmeta’
    • ‘x:xmpmeta.rdf:RDF’
    • ‘x:xmpmeta.rdf:RDF.rdf:Description’
    • ‘x:xmpmeta.rdf:RDF.rdf:Description.pdfaExtension:schemas’
    • ‘x:xmpmeta.rdf:RDF.rdf:Description.pdfaExtension:schemas.rdf:Bag’
  • $xmp (string): Custom XMP data. Each ‘rdf:li’ added to the ‘pdfaExtension:schemas’ bag should contain ‘pdfaSchema:schema’, ‘pdfaSchema:namespaceURI’, ‘pdfaSchema:prefix’, ‘pdfaSchema:property’ and ‘pdfaSchema:valueType’. Set the latter to an empty ‘rdf:Seq’ when the schema defines no custom structured value type: strict PDF/A validators reject extension schema entries without it.
  • $replace (bool): Replace the fragments already stored for the key instead of appending.

Returns: static

Throws:

  • Exception: if the fragment is not well-formed in the context of the key.

Source: src/MetaInfo.php:788

setDocCreationDate()

Sets the document creation date.

Drives the Info dictionary /CreationDate entry and the xmp:CreateDate XMP property. Defaults to the time the document object was constructed; set it explicitly to record a real creation date or to obtain reproducible output.

public setDocCreationDate(int|DateTimeInterface $time): static

Parameters:

  • $time (int|DateTimeInterface): Seconds since the Unix epoch, or a date object.

Returns: static

Source: src/MetaInfo.php:256

setDocModificationDate()

Sets the document modification date.

Drives the Info dictionary /ModDate entry and the xmp:ModifyDate and xmp:MetadataDate XMP properties.

public setDocModificationDate(int|DateTimeInterface $time): static

Parameters:

  • $time (int|DateTimeInterface): Seconds since the Unix epoch, or a date object.

Returns: static

Source: src/MetaInfo.php:270

setDocumentId()

Sets the identifier shared by all the renditions of the document.

Drives the XMP xmpMM:DocumentID property, which defaults to a value derived from the file identifier.

public setDocumentId(string $documentid): static

Parameters:

  • $documentid (string): 32 hexadecimal digits, or any other string, which is hashed to that form.

Returns: static

Source: src/MetaInfo.php:308

setFacturX()

Embed the XML payload of a hybrid electronic document (Factur-X, ZUGFeRD, Order-X) and declare it in the XMP metadata.

The XML is embedded as an associated file with the name, MIME type and /AFRelationship required by the profile, and the matching PDF/A extension schema and profile properties are added to the metadata stream.

The document must be in PDF/A-3 mode: a warning is raised at output time otherwise.

public setFacturX(
    string $xml,
    HybridProfile|string $profile = \Com\Tecnick\Pdf\HybridProfile::FacturX,
    HybridConformance|string $level = \Com\Tecnick\Pdf\HybridConformance::En16931,
    string $doctype = '',
    string $filename = '',
    string $version = '',
    string $desc = ''
): static

Parameters:

  • $xml (string): Content of the XML payload.
  • $profile (HybridProfile|string): Standard followed by the payload.
  • $level (HybridConformance|string): Conformance level of the payload.
  • $doctype (string): DocumentType property; defaults to the profile value.
  • $filename (string): Name of the embedded file; defaults to the profile value.
  • $version (string): Version property; defaults to the profile value.
  • $desc (string): Description of the embedded file; defaults to the profile value.

Returns: static

Throws:

Source: src/MetaInfo.php:884

setFileId()

Sets the document file identifier.

Drives the trailer /ID array and the XMP xmpMM:InstanceID property, which default to a random value. Pin it, together with the creation and modification dates, to obtain byte-for-byte reproducible output.

public setFileId(string $fileid): static

Parameters:

  • $fileid (string): 32 hexadecimal digits, or any other string, which is hashed to that form.

Returns: static

Throws:

  • Exception: if the document is encrypted, since the encryption key is derived from the file identifier chosen at construction time.

Source: src/MetaInfo.php:289

setKeywords()

Associates keywords with the document, generally in the form ‘keyword1 keyword2 …’.

An empty string removes the entry.

public setKeywords(string $keywords): static

Parameters:

  • $keywords (string): Space-separated list of keywords.

Returns: static

Source: src/MetaInfo.php:241

setOutputIntent()

Set the output intent describing the intended printing condition.

PDF/X (ISO 15930) requires the output intent to identify a real printing condition: either $identifier is a name registered in the ICC characterization data registry, or $iccfile must supply the profile emitted as /DestOutputProfile. PDF/X-4 and PDF/X-5 always require the embedded profile.

public setOutputIntent(
    string $identifier,
    string $iccfile = '',
    string $info = '',
    string $registry = 'http://www.color.org',
    string $condition = ''
): static

Parameters:

  • $identifier (string): Value of /OutputConditionIdentifier, for example ‘FOGRA39’.
  • $iccfile (string): Path of the ICC profile to embed as /DestOutputProfile. Subject to the same allowlist as every other local file read: the path must be covered by the ‘allowedPaths’ entry of the constructor fileOptions. Note that setting ‘allowedPaths’ replaces the package defaults, so the bundled font directory has to be listed again alongside the profile location.
  • $info (string): Human readable value of /Info. Defaults to $identifier.
  • $registry (string): Value of /RegistryName.
  • $condition (string): Human readable value of /OutputCondition.

Returns: static

Source: src/MetaInfo.php:423

setProducerSuffix()

Sets an application identification appended to the producer string.

Drives both the Info dictionary /Producer entry and the pdf:Producer XMP property, which ISO 19005 requires to be equivalent. Control characters are removed and the suffix is truncated to 255 characters.

public setProducerSuffix(string $suffix): static

Parameters:

  • $suffix (string): Application identification, or an empty string to remove it.

Returns: static

Source: src/MetaInfo.php:554

setSRGB()

Set the sRGB mode.

public setSRGB(bool $enabled): static

Parameters:

  • $enabled (bool): Set to true to add the default sRGB ICC color profile

Returns: static

Source: src/MetaInfo.php:397

setSubject()

Defines the subject of the document.

An empty string removes the entry.

public setSubject(string $subject): static

Parameters:

  • $subject (string): The subject.

Returns: static

Source: src/MetaInfo.php:215

setTitle()

Defines the title of the document.

An empty string removes the entry.

public setTitle(string $title): static

Parameters:

  • $title (string): The title.

Returns: static

Source: src/MetaInfo.php:228

setTrapped()

Sets the trapping status of the document.

Drives both the Info dictionary /Trapped entry and the pdf:Trapped XMP property, which ISO 19005 requires to be equivalent.

public setTrapped(string $trapped): static

Parameters:

  • $trapped (string): One of ‘True’, ‘False’ or ‘Unknown’ (case-insensitive). PDF/X does not allow ‘Unknown’; it is coerced to ‘False’.

Returns: static

Source: src/MetaInfo.php:351

setViewerPreferences()

Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.

public setViewerPreferences(TViewerPref $pref): static

Parameters:

  • $pref (TViewerPref): Array of options (see PDF reference “Viewer Preferences”).

Returns: static

Source: src/MetaInfo.php:1620

setXMPPaddingLines()

Sets the number of padding lines emitted before the end of the XMP packet.

Each line is 100 bytes. The XMP specification recommends about 2 KB of padding so that a reader can rewrite the metadata in place; set 0 to emit a read-only packet with no padding.

public setXMPPaddingLines(int $lines): static

Parameters:

  • $lines (int): Number of padding lines, capped at 200.

Returns: static

Source: src/MetaInfo.php:323

Inherited members

From Base

From Cell

From CSS

From HTML

From JavaScript

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