addBackgroundImage
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
addBackgroundImage
ADVANCED / PREMIUM
TRIAL
Inserts a watermark into a PDF document.
Description
public addBackgroundImage (string $source, string $img, [array $options])
Inserts a background image into a PDF document.
Parameters
source
Path to the PDF document.
target
Path to the output PDF.
image
Image path.
options
The possible keys and values are:
key | Type | Description |
---|---|---|
annotations | bool | Import annotations (links, comments and others). Default as false. |
height | mixed | Height value (0 as default, set the size automatically). Set 'auto' to use the height from the PDF. |
width | mixed | Width value (0 as default, set the size automatically). Set 'auto' to use the width from the PDF. |
opacity | float | Decimal number between 0 and 1 (optional), if not set defaults to 0.5. |
useFixedAnnotationPositions | bool | Force annotation page link IDs. Useful when using PDF readers that don't detect all PDF contents automatically. Default as false. |
Exceptions
File doesn't exist.
Image doesn't exist.
Code samples
Example #1
Release notes
- phpdocx 15.5:
- cast to int object stream content indexes.
- improved annotations support.
- phpdocx 14.0:
- useFixedAnnotationPositions option.
- phpdocx 13.0:
- improved working with indirect objects.
- phpdocx 12.0:
- improved annotations support.
- phpdocx 11.0:
- new method.