
# vue-pdf-viewer

vue-pdf-viewer is Vue component using to [https://mozilla.github.io/pdf.js/](https://mozilla.github.io/pdf.js/) to implement a PDF viewer.

## Installation

Use npm for easy install:

```shell
npm install @360learning/vue-pdf-viewer
```

## Use 

Simply import the component:

```vue
import PDFViewer from "@360learning/vue-pdf-viewer";
```

and then you can use it like any Vue component once registered:

```vue
<template>
    <div class="pdf">
        <PDFViewer
            :url="url"
        >
        </PDFViewer>
    </div>
</template>

 <script>
    import PDFViewer from "@360learning/vue-pdf-viewer";

    export default {
        components: {
            PDFViewer
        },
        data() {
            const url = "http://www.africau.edu/images/default/sample.pdf";
            return {
                url
            };
        }
    };
</script>
```

## Acknowledgement 

This library takes as it's starting point the excellent [demo](https://github.com/rossta/vue-pdfjs-demo) done by [Ross Kaffenberger](https://rossta.net/).

To learn more, checkout [the series of posts](https://rossta.net/blog/series/pdf-viewer.html) describing how his project was implemented.
1. [Basic page rendering](https://rossta.net/blog/building-a-pdf-viewer-with-vue-part-1.html)
1. [Fetching and rendering lazily](https://rossta.net/blog/building-a-pdf-viewer-with-vue-part-2.html)
1. [Extracting a data component](https://rossta.net/blog/extracting-a-data-component-in-vue.html)
1. [Refactoring to nested abstract components](https://rossta.net/blog/refactoring-to-nested-abstract-components-vuejs-pdf-viewer.html)

## License
[MIT](https://choosealicense.com/licenses/mit/)
