question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

try to use mammoth.js in angularjs

See original GitHub issue

I’m trying to use mammoth.js in a AngulaJS project. I added the standalone file mammoth.browser.min.js to my index.html file. Then i tryied to us eit in the controller as following:

`vm.convertHtml = function() {

 $window.mammoth.convertToHtml({path: "referto.docx"})
.then(function(result){
    var html = result.value; // The generated HTML
    var messages = result.messages; // Any messages, such as warnings during conversion
})
.done();

}`

but I get always the error : Could not find file in options

also changing the path. Can someone help me?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
miltonhowecommented, Jan 9, 2021

ArrayBuffer() is a method of File, which is a native type in the browser.

A short snippet of how I got this working in Angular (11). The file came from an <input> upload

import {convertToHtml} from "mammoth/mammoth.browser";
...
    const arrayBuffer: ArrayBuffer = await this.file.arrayBuffer();
    const htmlDoc: string = await convertToHtml({arrayBuffer});

Apologies to the author for continuing to post to this closed issue but I hope it helps someone.

1reaction
manojmaitycommented, Oct 28, 2019

Can anybody post a working sample for the above usecase?

Thanks in advance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learn Angular JS 2021 – Hello World Tutorial for Beginners
Build your first AngularJS project. by Alexandra Kropova from Mammoth Interactive. Steps to make a Hello World app: Build an HTML file; Convert...
Read more >
EXCEPTION: mammoth is not defined - Stack Overflow
I am trying to integrate mammoth npm library with meteor. When using the import command, import { mammoth } from "mammoth"; was getting....
Read more >
Bullet proof AngularJS migration using iframes - codecraft.tv
This feels like migrating from a legacy AngularJS application to a legacy Angular application. Update your AngularJS code to get rid of the ......
Read more >
ngx-doc-viewer - npm
Start using ngx-doc-viewer in your project by running `npm i ... be shown using the mammoth viewer or pdf viewer by passing an...
Read more >
Angular Js - Mammoth-AI
As a top AngularJS development company, we offer resources with diverse coding and industry backgrounds and a variety of skill levels. We work...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found