Refactor image to accept Buffer only

This commit is contained in:
Dolan
2018-08-12 23:07:31 +01:00
parent bc1132146f
commit 675192b86f
12 changed files with 35 additions and 66 deletions

View File

@ -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

View File

@ -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,