svelte-pdfjs
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "svelte-pdfjs", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"devDependencies": { | ||
"@sveltejs/adapter-netlify": "^1.0.0-next.35", | ||
"@sveltejs/adapter-node": "^1.0.0-next.55", | ||
"@sveltejs/adapter-netlify": "^1.0.0-next.36", | ||
"@sveltejs/kit": "next", | ||
"@typescript-eslint/eslint-plugin": "^4.31.1", | ||
"@typescript-eslint/parser": "^4.31.1", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-svelte3": "^3.2.1", | ||
"prettier": "^2.4.1", | ||
"prettier-plugin-svelte": "^2.4.0", | ||
"svelte": "^3.42.6", | ||
"svelte-check": "^2.2.6", | ||
"svelte-preprocess": "^4.9.4", | ||
"svelte2tsx": "^0.4.8", | ||
"prettier": "^2.5.1", | ||
"prettier-plugin-svelte": "^2.5.1", | ||
"svelte": "^3.44.3", | ||
"svelte-check": "^2.2.11", | ||
"svelte-preprocess": "^4.10.1", | ||
"svelte2tsx": "^0.4.12", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.4.3" | ||
"typescript": "^4.5.4" | ||
}, | ||
"type": "module", | ||
"dependencies": { | ||
"pdfjs-dist": "^2.10.377" | ||
"pdfjs-dist": "^2.12.313" | ||
}, | ||
@@ -37,3 +36,4 @@ "exports": { | ||
}, | ||
"svelte": "./index.js" | ||
"svelte": "./index.js", | ||
"readme": "## svelte-pdfjs\r\n\r\nA wrapper around Mozilla's PDFJS renderer. Only cares about loading and showing the PDF and nothing else, all the fancy stuff such as styling the viewer is left up to the consumer. Still in early stages so feel free to create an issue or a PR for any bugs that you find, any improvements or feature requests.\r\n\r\n## Usage\r\nSee [src/routes/index.svelte](src/routes/index.svelte) \r\nDemo: [Netlify](https://svelte-pdfjs.netlify.app)\r\n\r\n## SvelteKit\r\n\r\nIt's compatible with SvelteKit, just import the component and use it. No onMount shenanigans required in the consumer since it's already done within the PDFViewer component.\r\n\r\n## TODOs: \r\n- [x] Text layer rendering\r\n- [x] SvelteKit compatibility\r\n- [ ] Think of a better name for the `zoomLevel` prop on `Page`\r\n- [ ] SVG renderer\r\n- [ ] Annotation layer\r\n- [ ] Error handling\r\n- [ ] Expose more stuff\r\n\r\n## License\r\n\r\n[MIT](LICENSE)\r\n" | ||
} |
@@ -5,7 +5,16 @@ import { SvelteComponentTyped } from "svelte"; | ||
props: { | ||
file?: string | URL; | ||
loadOptions?: DocumentInitParameters; | ||
onProgress?: (params: OnProgressParameters) => void; | ||
/** | ||
* The URL of the file to load. | ||
*/ file?: string | URL; | ||
/** | ||
* Extra options provided to PDFJS.getDocument. [See 🔗](https://github.com/mozilla/pdf.js/blob/41dab8e7b6c1e2684d4afabb8f02e40a874d8e85/src/display/api.js#L126) | ||
*/ loadOptions?: DocumentInitParameters; | ||
/** | ||
* Callback that fires everytime a part of the PDF is downloaded. Can be useful for showing a progress bar. | ||
*/ onProgress?: (params: OnProgressParameters) => void; | ||
}; | ||
events: { | ||
loadsuccess: any; | ||
loaderror: any; | ||
} & { | ||
[evt: string]: CustomEvent<any>; | ||
@@ -20,4 +29,8 @@ }; | ||
export declare type DocumentSlots = typeof __propDef.slots; | ||
/** | ||
* Renderless component responsible for just loading the document and providing it to | ||
* children Page components through the context API (key: svelte_pdf_current_doc) | ||
*/ | ||
export default class Document extends SvelteComponentTyped<DocumentProps, DocumentEvents, DocumentSlots> { | ||
} | ||
export {}; |
import { SvelteComponentTyped } from "svelte"; | ||
declare const __propDef: { | ||
props: { | ||
pageType?: 'canvas' | 'svg'; | ||
pageNumber?: number; | ||
zoomLevel?: number; | ||
targetHeight?: number; | ||
targetWidth?: number; | ||
rotation?: 0 | 90 | 180 | 270; | ||
/** | ||
* What renderer implementation to use for the page. | ||
* Defaults to canvas. SVG rendering not implemented yet. | ||
*/ renderer?: 'canvas' | 'svg'; | ||
/** | ||
* The page number to show. | ||
*/ pageNumber?: number; | ||
/** | ||
* The scale to show the PDF at. | ||
*/ zoomLevel?: number; | ||
/** | ||
* Override the height to render the page at. | ||
* If both `targetHeight` and `targetWidth` are provided, then targetWidth takes precedence. | ||
*/ targetHeight?: number; | ||
/** | ||
* Override the width to render the page at. | ||
* If both `targetHeight` and `targetWidth` are provided, then targetWidth takes precedence. | ||
*/ targetWidth?: number; | ||
/** | ||
* Rotate the page by a multiple of 90 degrees. | ||
*/ rotation?: 0 | 90 | 180 | 270; | ||
}; | ||
@@ -19,4 +34,5 @@ events: { | ||
export declare type PageSlots = typeof __propDef.slots; | ||
/** Render a page from a PDF document. Must be a child of a `Document` component. */ | ||
export default class Page extends SvelteComponentTyped<PageProps, PageEvents, PageSlots> { | ||
} | ||
export {}; |
@@ -6,3 +6,3 @@ ## svelte-pdfjs | ||
## Usage | ||
See [src/routes/index.svelte](src/routes/index.svelte) | ||
See [src/routes/index.svelte](src/routes/index.svelte) | ||
Demo: [Netlify](https://svelte-pdfjs.netlify.app) | ||
@@ -16,9 +16,11 @@ | ||
- [x] Text layer rendering | ||
- [x] SvelteKit compatibility | ||
- [x] SvelteKit compatibility | ||
- [ ] Think of a better name for the `zoomLevel` prop on `Page` | ||
- [ ] SVG renderer | ||
- [ ] Annotation layer | ||
- [ ] Annotation layer | ||
- [ ] Error handling | ||
- [ ] Expose more stuff | ||
## License | ||
[MIT](LICENSE) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17043
15
173
25
0
Updatedpdfjs-dist@^2.12.313