Skip to content

Commit

Permalink
Add link service prop (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrynko authored Jan 12, 2025
1 parent 0fccfd3 commit 35ff6b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,18 @@ const pdfSource = '<PDF_URL>'

### Props

| Name | Type | Accepted values | Description |
| ------------------ | ---------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------- |
| annotationLayer | `boolean` | `true` or `false` | whether the annotation layer should be enabled |
| height | `number` | natural numbers | desired page height in pixels (ignored if the width property is specified) |
| imageResourcesPath | `string` | URL or path with trailing slash | path for icons used in the annotation layer |
| page | `number` | `1` to the last page number | number of the page to display (displaying all pages if not specified) |
| rotation | `number` | `0`, `90`, `180`, `270` (multiples of `90`) | desired page rotation angle in degrees |
| scale | `number` | rational numbers | desired page viewport scale |
| source | `string` <br> `object` | document URL or Base64 or typed array or document proxy | source of the document to display |
| textLayer | `boolean` | `true` or `false` | whether the text layer should be enabled |
| width | `number` | natural numbers | desired page width in pixels |
| Name | Type | Accepted values | Description |
| ------------------ | ---------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| annotationLayer | `boolean` | | whether the annotation layer should be enabled |
| height | `number` | natural numbers | desired page height in pixels (ignored if the width property is specified) |
| imageResourcesPath | `string` | URL or path with trailing slash | path for icons used in the annotation layer |
| linkService | `PDFLinkService` | | document navigation service to override the default one (emitting `internal-link-clicked`) |
| page | `number` | `1` to the last page number | number of the page to display (displaying all pages if not specified) |
| rotation | `number` | `0`, `90`, `180`, `270` (multiples of `90`) | desired page rotation angle in degrees |
| scale | `number` | rational numbers | desired page viewport scale |
| source | `string` <br> `object` <br> `PDFDocumentProxy` | document URL or Base64 or typed array or document proxy | source of the document to display |
| textLayer | `boolean` | | whether the text layer should be enabled |
| width | `number` | natural numbers | desired page width in pixels |

### Events

Expand Down
6 changes: 6 additions & 0 deletions src/VuePdfEmbed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const props = withDefaults(
* Path for annotation icons, including trailing slash.
*/
imageResourcesPath?: string
/**
* Document navigation service.
*/
linkService?: PDFLinkService
/**
* Number of the page to display.
*/
Expand Down Expand Up @@ -103,6 +107,8 @@ const { doc } = useVuePdfEmbed({
const linkService = computed(() => {
if (!doc.value || !props.annotationLayer) {
return null
} else if (props.linkService) {
return props.linkService
}
const service = new PDFLinkService()
Expand Down

0 comments on commit 35ff6b4

Please sign in to comment.