Table of contents
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:
- Exception: in case of error.
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
- BORDERPOS_DEFAULT: The default relative position of the cell origin when the border is centered on the cell edge.
- BORDERPOS_EXTERNAL: The relative position of the cell origin when the border is external to the cell edge.
- BORDERPOS_INTERNAL: The relative position of the cell origin when the border is internal to the cell edge.
- ZEROCELL: Default values for cell.
- ZEROCELLBOUND: Default values for cell boundaries.
- $barcode: Barcode object.
- $cache: Cache object.
- $color: Color object.
- $encrypt: Encrypt object.
- $file: File object.
- $font: Font object.
- $graph: Graph object.
- $image: Image Import object.
- $markupFile: File object for markup-originated resources.
- $page: Page object.
- $pon: Current PDF object number.
- $uniconv: Unicode Convert object.
- defaultFileAllowedPaths(): Returns the default array of allowed file paths.
- defaultMarkupAllowedPaths(): Returns the default array of allowed file paths for markup-originated resources.
- enableDefaultPageContent(): Enable or disable the default page content.
- getWarnings(): Return the conformance warnings raised while the document was rendered.
- initClassObjects(): Initialize dependencies class objects.
- setPDFVersion(): Set the PDF version (check PDF reference for valid values).
- setRTL(): Set the default document language direction.
- toPoints(): Convert user units to internal points unit.
- toUnit(): Convert internal points to user unit.
- toYPoints(): Convert vertical user value to internal points unit.
- toYUnit(): Convert vertical internal points value to user unit.
From Cell
- setDefaultCellBorderPos(): Sets the default cell border position.
- setDefaultCellMargin(): Set the default cell margin in user units.
- setDefaultCellPadding(): Set the default cell padding in user units.
From CSS
- addGlobalCSS(): Append CSS content to the global CSS applied as a base stylesheet to all HTML rendering calls.
- resetGlobalCSS(): Reset (clear) the global CSS so no base stylesheet is applied to HTML rendering calls.
- setDefaultCSSBorderSpacing(): Set the default CSS border spacing in user units.
- setDefaultCSSMargin(): Set the default CSS margin in user units.
- setDefaultCSSPadding(): Set the default CSS padding in user units.
- setGlobalCSS(): Set the global CSS content applied as a base stylesheet to all HTML rendering calls.
From HTML
- addHTMLCell(): Adds an HTML block inside a rectangular cell.
- getHTMLCell(): Returns the PDF code to render an HTML block inside a rectangular cell.
- getHTMLDOMCSSData(): Returns the styles array that apply for the selected HTML tag.
- isValidCSSSelectorForTag(): Returns true if the CSS selector is valid for the selected HTML tag.
- parseHTMLAttributes(): Parst HTML DOM attributes.
- parseHTMLStyleAttributes(): Parse HTML DOM Style attributes.
- setHtmlImageImportResize(): Enable or disable HTML raster image downscaling on import.
- setHTMLMonospaceFont(): Set the monospaced font used for <pre>, <code> and <tt> elements.
- setHtmlVSpace(): Set custom vertical spacing for HTML block tags.
- setULLIDot(): Sets the default symbol to be used as unordered-list (UL) list-item (LI) bullet.
- strTrim(): Trim the input string.
- strTrimLeft(): Left trim the input string.
- strTrimRight(): Right trim the input string.
- tidyHTML(): Cleanup HTML code (requires HTML Tidy library).
From JavaScript
- addContentAsEmbeddedFile(): Add string content as an embedded file.
- addEmbeddedFile(): Add an embedded file.
- addFFButton(): Adds an annotation button form field.
- addFFCheckBox(): Adds an annotation checkbox form field.
- addFFComboBox(): Adds an annotation combobox (select) form field.
- addFFListBox(): Adds an annotation listbox (select) form field.
- addFFRadioButton(): Adds an annotation radiobutton form field.
- addFFText(): Adds an annotation text form field.
- addInternalLink(): Defines the page and vertical position an internal link points to.
- addJSButton(): Adds a JavaScript button form field.
- addJSCheckBox(): Adds a JavaScript checkbox form field.
- addJSComboBox(): Adds a JavaScript combobox (select) form field.
- addJSListBox(): Adds a JavaScript listbox (select) form field.
- addJSRadioButton(): Adds a JavaScript radiobutton form field.
- addJSText(): Adds a JavaScript text form field.
- addRawJavaScriptObj(): Add a raw javascript string as new object.
- addXObjectContent(): Add the specified raw PDF content to the XObject template.
- addXObjectExtGStateID(): Add the specified ExtGState ID to the XObject template.
- addXObjectFontID(): Add the specified Font ID to the XObject template.
- addXObjectGradientID(): Add the specified Gradient ID to the XObject template.
- addXObjectImageID(): Add the specified Image ID to the XObject template.
- addXObjectSpotColorID(): Add the specified SpotColor ID to the XObject template.
- addXObjectXObjectID(): Add the specified XObject ID to the XObject template.
- appendRawJavaScript(): Append raw javascript string to the global one.
- exitXObjectTemplate(): Exit from the XObject template mode.
- getDefJSAnnotProp(): Returns the default Javascript Annotation properties.
- getXObjectTemplate(): Returns the PDF code to render the specified XObject template.
- newXObjectTemplate(): Create a new XObject template and return the object id.
- setAnnotation(): Add an annotation and returns the object id.
- setBookmark(): Add a bookmark entry.
- setDefJSAnnotProp(): Set the default Javascript Annotation properties.
- setLink(): Creates a link in the specified area.
- setNamedDestination(): Add a named destination.
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
- addArtifactContent(): Add non-semantic content wrapped as Artifact marked-content.
- addPage(): Add a new page (wrapper function for $this->page->add()).
- addTaggedFigureContent(): Add non-text graphical content as a tagged Figure block in PDF/UA mode.
- addTextCell(): Adds a text block inside a rectangular cell using relative coordinates.
- addTextCellXY(): Adds a text block inside a rectangular cell using absolute page coordinates.
- beginArtifact(): Open an Artifact marked-content block for non-semantic page content.
- beginStructElem(): Open a PDF/UA structure element bracket.
- defaultPageContent(): Sets the page common content like Header and Footer.
- enableZeroWidthBreakPoints(): Enable or disable automatic line breaking points after some non-letter character types.
- endArtifact(): Close an Artifact marked-content block opened by beginArtifact().
- endStructElem(): Close the current PDF/UA structure element bracket.
- getLastBBox(): Returns the last text fragment bounding box as {x, y, w, h} (left, top, width, height).
- getLastCellBBox(): Returns the last Cell bounding box as {x, y, w, h} (left, top, width, height).
- getLastTextBBox(): Returns the last Text bounding box as {x, y, w, h} (left, top, width, height).
- getTextCell(): Returns the PDF code to render a text block inside a rectangular cell.
- getTextLine(): Returns the PDF code to render a single line of text.
- loadTexHyphenPatterns(): Returns an array of hyphenation patterns.
- resumePdfUaTagging(): Resume structure tagging, restoring the mode returned by suspendPdfUaTagging().
- setCurrentPage(): Set the current page number (move to the specified page).
- setTexHyphenPatterns(): Sets the hyphen patterns for text.
- suspendPdfUaTagging(): Suspend structure tagging and marked-content recording.