(mPDFI >= 2.3)
OverWrite – Replace specified text strings in an existing PDF file
mixed OverWrite ( string $sourcefile , mixed $search , mixed $replacement [, string $dest [, string $file_out ]])
Using the class extension mPDFI, an existing PDF file can be overwritten, replacing specified text with alternatives. For example you may have created a long complex PDF file, and you wish to produce copies with an individual number on each copy without having to re-generate the whole document each time.
Overwrite() does not re-flow the text from the source file. If the $replacement string is longer than the $search string, it may overlap the following text.
This parameter specifies the source PDF file to use. $sourcefile should be a relative path to a local file.
The pattern to search for. It can be either a string or an array with strings. Must only contain only ASCII characters.
If the document is utf-8 mode, the search patterns must not exist in text with justified alignment. (Justified text is achieved in mPDF by varying the character spacing for each SPACE between words; this breaks up the text in the PDF file.)
The string or an array with strings to replace. $replacement can contain any utf-8 encoded characters.
If this parameter is a string and the $search parameter is an array, only the first $search element will be replaced by the $replacement string, any extra $search s will be replaced by an empty string. If both $search and $replacement parameters are arrays, each $search will be replaced by the $replacement counterpart. If there are fewer elements in the $replacement array than in the $search array, any extra $search s will be replaced by an empty string.
$dest specifies the destination for the generated PDF document.
D: download the PDF file
I: serves in-line to the browser
S: returns the PDF document as a string
F: save as file $file_out
This parameter specifies the filename for the output PDF file. No path should be included unless $dest is set as “F”.
OverWrite() returns the PDF file as a string if $dest is set to “S”.
|2.3||Function was added.|
- mPDFI() - Class constructor for importing files and templates
- Thumbnail() - Print thumbnails of an external PDF file
- SetSourceFile() - Specify the source PDF file used to import pages into the document
- ImportPage() - Import a page from an external PDF file
- UseTemplate() - Insert an imported page from an external PDF file
- SetPageTemplate() - Specify a page from an external PDF file to use as a template
- SetDocTemplate() - Specify an external PDF file to use as a template
- RestartDocTemplate() - Re-start the use of a Document template from the next page