Documentation

CRM_Utils_PDF_Document
in package

Class CRM_Utils_PDF_Document.

Table of Contents

Properties

$ooxmlMap  : mixed

Methods

docReader()  : array<string|int, mixed>
html2doc()  : mixed
Convert html to a Doc file.
printDoc()  : mixed
printDocuments()  : string
Modify contents of docx/odt file(s) and later merged into one final document
toTwip()  : float
unzipDoc()  : array<string|int, mixed>
Extract content of docx/odt file

Properties

$ooxmlMap

public static mixed $ooxmlMap = ['docx' => ['dataFile' => 'word/document.xml', 'startTag' => '<w:body>', 'pageBreak' => '<w:p><w:pPr><w:pStyle w:val="Normal"/><w:rPr></w:rPr></w:pPr><w:r><w:rPr></w:rPr></w:r><w:r><w:br w:type="page"/></w:r></w:p>', 'endTag' => '</w:body></w:document>'], 'odt' => ['dataFile' => 'content.xml', 'startTag' => '<office:body>', 'pageBreak' => '<text:p text:style-name="Standard"></text:p>', 'endTag' => '</office:body></office:document-content>']]

Methods

docReader()

public static docReader(array<string|int, mixed> $path, string $type) : array<string|int, mixed>
Parameters
$path : array<string|int, mixed>

docx/odt file path

$type : string

File type

Return values
array<string|int, mixed>

Return extracted content of document in HTML and document type

html2doc()

Convert html to a Doc file.

public static html2doc(array<string|int, mixed> $pages, string $fileName[, array<string|int, mixed>|int $format = [] ]) : mixed
Parameters
$pages : array<string|int, mixed>

List of HTML snippets.

$fileName : string

The logical filename to return to client. Ex: "HelloWorld.odt".

$format : array<string|int, mixed>|int = []

printDoc()

public static printDoc(object|string $phpWord, string $ext, string $fileName) : mixed
Parameters
$phpWord : object|string
$ext : string

File extension/type. Ex: docx, odt, html.

$fileName : string

The logical filename to return to client. Ex: "HelloWorld.odt". Alternatively, a full path of a file to display. This seems sketchy. Ex: "/var/lib/data/HelloWorld.odt".

printDocuments()

Modify contents of docx/odt file(s) and later merged into one final document

public static printDocuments(array<string|int, mixed> $contents, string $fileName, string $docType, clsTbsZip $zip[, bool $returnFinalContent = FALSE ]) : string
Parameters
$contents : array<string|int, mixed>

Content of formatted/token-replaced document. List of HTML snippets.

$fileName : string

The logical filename to return to client. Ex: "HelloWorld.odt".

$docType : string

Document type e.g. odt/docx

$zip : clsTbsZip

Zip archive

$returnFinalContent : bool = FALSE

Return the content of file document as a string used in unit test

Return values
string

toTwip()

public static toTwip(int $value, string $metric) : float
Parameters
$value : int
$metric : string
Return values
float

unzipDoc()

Extract content of docx/odt file

public static unzipDoc(string $filePath, string $docType) : array<string|int, mixed>
Parameters
$filePath : string

Document file path

$docType : string

File type of document

Return values
array<string|int, mixed>

[string, clsTbsZip]


        
On this page

Search results