JSON API - addSVG
- addBarcode
- addBookmark
- addBreak
- addCaption
- addChart
- addComment
- addCrossReference
- addDateAndHour
- addDropCap
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addPageNumber
- addRuby
- addSimpleField
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordML
- addWordFragment
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setCompatibilityMode
- setDefaultFont
- setDocumentDefaultStyles
- 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
addSVG
PREMIUM
TRIAL / ADVANCED
Inserts an SVG.
Note
You are reading the JSON API documentation. For the PHP API method please go to addSVG.
To keep compatibility with DOCX readers not compatible with SVG images, a PNG image with the same content is added too in the document.
This method requires the PHP ImageMagick extension installed and enabled.
JSON data
| Key | Description |
|---|---|
| svg |
Path to the local file or string. |
| borderColor | Hexadecimal color: FF0000. |
| borderStyle | Possible values are:
|
| borderWidth | Given in emus (1cm = 360000 emus). |
| caption |
|
| descr | Custom descr value. |
| distance |
Not available using inline textWrap. Spacing options can be used to set spacings in all cases. Default as 0. |
| dpi | Dots per inch. |
| float | (left, right, center) floating image. It only applies if textWrap is not inline (default value). |
| height | Image height in pixels. |
| horizontalOffset | Given in emus (1cm = 360000 emus). Only applies if the image is not floating. |
| hyperlink | Image link (hyperlink or bookmark). |
| imageAlign | Image alignment: right, center... |
| mime | Forces a mime (image/jpg, image/jpeg, image/png, image/gif, image/bmp, image/webp). |
| relativeToHorizontal | margin (default), page, column, character, leftMargin, rightMargin, insideMargin, outsideMargin. Not compatible with inline text wrapping. |
| relativeToVertical | margin, page, line (default), paragraph, topMargin, bottomMargin, insideMargin, outsideMargin. Not compatible with inline text wrapping. |
| scaling | % of size: 50, 100. |
| spacingTop | Spacing top in pixels. |
| spacingBottom | Spacing bottom in pixels. |
| spacingLeft | Spacing left in pixels. |
| spacingRight | Spacing right in pixels. |
| streamMode | If true, uses src as stream. |
| target | document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter, comment, endnote or footnote. |
| textWrap | Text wrap:
|
| verticalAlign | top, center, bottom. To be used with relativeFromVertical. |
| verticalOffset | Given in emus (1cm = 360000 emus). |
| width | Image width in pixels. |
Code samples
Example #1
Example #2
Release notes
- phpdocx 18.0:
- new action.
