Some test text!

Jul 11 2022

How to Open DOCX in a Vue Web App

by Andrey Safonov

Looking for a Vue DOCX web app? This blog discusses viewing Microsoft Office documents in a Vue file viewer app using PDFTron’s WebViewer. It also includes Microsoft Word, Excel, and PowerPoint formats and legacy formats such as DOC, XLS, and PPT. 

Using just a few lines of code, you can display files client-side, without server dependencies, Microsoft Office licenses, or third-party software. PDFTron’s WebViewer directly converts `DOCX,` `XLSX,` and `PPTX` files using JavaScript and renders them to view dynamically. 

To see this in action, use our 

 to test WebViewer with your files. 

Check out the Vue doc viewer demo on

, and visit the documentation for
get-started steps
and further information on additional functionality. 

Additional Functionality 

WebViewer supports more than viewing Office documents. It also offers

,
mail merge
on XLSX templates,
text editing
,
page manipulation
,
redaction
,
form filling and creation
, to name a few.  

In addition, WebViewer also supports formats such as PDF, images,

, and
CAD
documents. 

How to View DOCX in a Vue Web App 

Step 1 - Get Started 

Once the Vue doc viewer example is running,

the URL, blob, file path, or arrayBuffer to `initialDoc` property in WebViewer constructor. 

Code Example for a Vue Document Viewer 

WebViewer({
  ...,
  initialDoc: 'https://myserver.com/myfile.docx',
}, document.getElementById('viewer'));

Or use the same parameters to call `loadDocument`.

WebViewer(...)
  .then(instance => {
    instance.UI.loadDocument('https://myserver.com/myfile.docx', { filename: 'myfile.docx' });
  });

Step 2 - Run the App

Now, run the app via 'npm start'.  

To view the npm Vue file viewer xlsx app, go to

. The app automatically reloads if any source files change. 

A Customizable UI 

To configure the UI, WebViewer uses a rich set of APIs. View the

to see the possibilities, or
create your own UI
by referencing our open-source
UI code

Conclusion 

It is easy and straightforward to add Office document viewing and collaboration to your native npm Vue file browser app with PDFTron’s WebViewer, a

. The source code for this blog post is available on our
GitHub
page.  

You can also see other capabilities on our

If you have any questions about PDFTron’s SDK or WebViewer, please

Related articles

thumbnail

How Can I Tell What’s Inside a PDF? Raster, Vector, Text?

Learn about the content types you find in PDFs and discover tricks & toolsfor figuring out what’s inside your PDF – raster, vector, or text?

thumbnail

PDF Rendering and Viewing: What is the Difference?

In this post, learn about the difference between PDF rendering and PDF viewing, and how the PDFTron PDF SDK unpacks your PDFs for display in a viewer application.

thumbnail

Open Source or Proprietary — What PDF Viewer Engine is Right for My Application?

A comparison of PDF viewer library options and tips on how to decide which PDF rendering and viewing alternative is best for your application. Open source or proprietary?

ANDREY SAFONOV

Head of Product

First a developer then a solution engineer. Now a product team leader and dev experience advocate.

Related Products

Share this post

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use