Refactor image to accept Buffer only
This commit is contained in:
@ -19,8 +19,8 @@ doc.Footer.createParagraph("Footer text");
|
||||
Even add images:
|
||||
|
||||
```js
|
||||
doc.Header.createImage([PATH_TO_YOUR_IMAGE]);
|
||||
doc.Footer.createImage([PATH_TO_YOUR_IMAGE]);
|
||||
doc.Header.createImage([BUFFER_OF_YOUR_IMAGE]);
|
||||
doc.Footer.createImage([BUFFER_OF_YOUR_IMAGE]);
|
||||
```
|
||||
|
||||
Refer to `demo8.js` for more information
|
||||
|
@ -7,7 +7,7 @@ Adding images is very simple
|
||||
Simply call the `createImage` method:
|
||||
|
||||
```js
|
||||
const image = doc.createImage([PATH_TO_YOUR_IMAGE]);
|
||||
const image = doc.createImage([BUFFER_OF_YOUR_IMAGE]);
|
||||
```
|
||||
|
||||
`docx` supports `jpeg`, `jpg`, `bmp`, `gif` and `png`
|
||||
@ -43,7 +43,7 @@ interface DrawingOptions {
|
||||
can be passed when creating `PictureRun()` for example:
|
||||
|
||||
```js
|
||||
const imageData = document.createImageData(filename, buffer, 903, 1149);
|
||||
const imageData = document.createImage(buffer, 903, 1149);
|
||||
|
||||
new docx.PictureRun(imageData, {
|
||||
position: docx.PlacementPosition.FLOATING,
|
||||
|
Reference in New Issue
Block a user