Hello,
I'm using [email protected].
The code below returns doc.createDrawing is not a function :
const doc = new docx.Document();
const paragraph = new docx.Paragraph('Some text.');
paragraph.addRun(new docx.TextRun('Some text run.'));
doc.addParagraph(paragraph);
const buff = fs.readFileSync('/tmp/w3c_home.png');
const image_data = doc.createImageData('Dummy dummy', buff);
doc.createDrawing(image_data);
What am I doing wrong?
Maybe related to #89
Can you try this?
https://github.com/dolanmiu/docx/blob/feat/base64-image/demo/demo18.js
doc.Document.createDrawing(image) works perfectly, thanks a lot!
It's just a bit strange for the API to offer createImageData on the doc instance, while createDrawing must be accessed through a sub-object/property Document.
I leave it to you to close this ticket or not, depending on whether you consider that there is an API problem or not.
In any case: thank you again!
Yes, I am in the process of remaking the API, i agree it is a bit convoluted
Thanks a lot for your answer and your package!
Most helpful comment
Yes, I am in the process of remaking the API, i agree it is a bit convoluted