# pdfvuermy
**Repository Path**: dontcallmilanac/pdfvuermy
## Basic Information
- **Project Name**: pdfvuermy
- **Description**: A PDF viewer for Vue using Mozilla's PDF.js that supports both Vue2 and Vue3
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 3
- **Forks**: 1
- **Created**: 2022-02-18
- **Last Updated**: 2023-01-29
## Categories & Tags
**Categories**: vue-extensions
**Tags**: None
## README
# Pdfvuer
> A PDF viewer for Vue using Mozilla's PDF.js
[](https://badge.fury.io/js/pdfvuer)
## Install
For Vue 2:
```
npm install --save pdfvuer
```
For Vue 3:
```
npm i pdfvuer@next --save
```
## Example - basic
```vue
loading content here...
```
## API
### Props
#### :src String / Object - default: ''
The url of the pdf file. `src` may also be a `string|TypedArray|DocumentInitParameters|PDFDataRangeTransport` for more details, see [`PDFJS.getDocument()`](https://github.com/mozilla/pdf.js/blob/8ff1fbe7f819513e7d0023df961e3d223b35aefa/src/display/api.js#L117).
#### :page Number - default: 1
The page number to display.
#### :rotate Number - default: 0
The page rotation in degrees, only multiple of 90 are valid.
#### :scale Number / String - default: 'page-width' - .sync
The scaling factor. By default, the pdf will be scaled to match the page width
with the container width.
When passed value `page-width` and / or using `resize` prop, will send back the scale
computed accordingly via `update:scale` event (use it with `scale.sync="scale"`)
#### :resize Boolean - default: false
Enable Auto Resizing on window resize. By default, autoresizing is disabled.
#### :annotation Boolean - default: false
Show the annotations in the pdf. By default, annotation layer is disabled.
#### :text Boolean - default: true
Show the text layer in the pdf. By default, text layer is enabled.
### Events
#### @numpages Number
The total number of pages of the pdf.
#### @loading Boolean
The provided PDF's loading state
#### @error Function
Function handler for errors occurred during loading/drawing PDF source.
#### @link-clicked Function
Function handler for errors occurred during loading/drawing PDF source.
Example:
```js
handle_pdf_link: function (params) {
// Scroll to the appropriate place on our page - the Y component of
// params.destArray * (div height / ???), from the bottom of the page div
var page = document.getElementById(String(params.pageNumber));
page.scrollIntoView();
}
```
### Public static methods
#### createLoadingTask(src)
* `src`: see `:src` prop
This function creates a PDFJS loading task that can be used and reused as `:src` property.
## Public Demo
Advanced Example - [https://arkokoley.github.io/pdfvuer](https://arkokoley.github.io/pdfvuer)
[Used in production by Gratia](https://goodwill.zense.co.in/resources/1)
> Made with :heart: in Bangalore, India
## License
MIT © [Gaurav Koley](https://gaurav.koley.in), 2021