Marcelh1983 / angular-document-viewer

MIT License
62 stars 23 forks source link

Can the url of the document be replaced by byte array. #8

Closed manojmaity closed 5 years ago

manojmaity commented 5 years ago

Hi there, We have got a webapi, which return file content as byte array. Using angular application we have to showcase a preview of the document to the user. Can the url of the document, be replaced by byte array.

Thanks in advance.

Marcelh1983 commented 5 years ago

Hi @manojmaity this is just a wrapper for the google and office document viewer with only supports url's. The only ways is to serve the document somewhere e.g. use something like Azure blob storage.

Marcelh1983 commented 4 years ago

Hi @manojmaity maybe you don't need it anymore but npm i ngx-doc-viewer@next will have the mammoth viewer. Which converts docx to html locally. If you use createObjectURL() from your byte array if will work.

Also add mammoth:

npm install mammoth --save

and make sure mammoth.browser.min.js is loaded. For the angular/cli you would add the following in angular.json:

    "scripts": [
        "node_modules/mammoth/mammoth.browser.min.js"
    ]

See the demo site in local-files branch for example code.

manojmaity commented 4 years ago

First of all thanks for replying, with such cutting edge solution. I will definitely give it a try.

On Fri 10 Jan, 2020, 4:06 PM Marcel Hoekstra, notifications@github.com wrote:

Hi @manojmaity https://github.com/manojmaity maybe you don't need it anymore but npm i ngx-doc-viewer@next will have the mammoth viewer. Which converts docx to html locally. If you use createObjectURL() from your byte array if will work.

Also add mammoth:

npm install mammoth --save

and make sure mammoth.browser.min.js is loaded. For the angular/cli you would add the following in angular.json:

"scripts": [
    "node_modules/mammoth/mammoth.browser.min.js"
]

See the demo site in local-files branch for example code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Marcelh1983/angular-document-viewer/issues/8?email_source=notifications&email_token=ADZLYNQCPAXZADT6EOZBKFTQ5BFSXA5CNFSM4JDNZYA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEITQCSQ#issuecomment-572981578, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZLYNS24ID7EIEWFU3YGD3Q5BFSXANCNFSM4JDNZYAQ .