pdf-ysk-vue3 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 hyminghan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 hyminghan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,75 +1,73 @@
1
- # pdf-vue3
2
-
3
- [English](./README.md) [中文](./README_ZH.md)
4
-
5
- vue3 pdf viewer
6
-
7
- example: <https://hymhub.github.io/pdf-vue3/>
8
-
9
- <img src="./pdf-vue3-demo.gif" style="width: 375px;" />
10
-
11
- ## Install
12
-
13
- ```bash
14
- npm i pdf-vue3
15
- ```
16
-
17
- ## Usage
18
-
19
- ```vue
20
- <script setup>
21
- import PDF from "pdf-vue3";
22
- </script>
23
-
24
- <template>
25
- <PDF src="/demo.pdf" />
26
- <!-- <PDF :src="BASE64" /> -->
27
- <!-- <PDF :src="Uint8Array" /> -->
28
- </template>
29
- ```
30
-
31
- ## Config API
32
-
33
- ### `Props`
34
-
35
- | Attribute | Description | Type |
36
- | :----------------: | :---------- | :----------------------------------: |
37
- | `src` | The URL or binary data(Uint8Array) or BASE64-encoded of the PDF. | `string` \| `Uint8Array` \| `BASE64` |
38
- | `showProgress` | Whether to download the progress bar. The default value is `true`. | `boolean` |
39
- | `progressColor` | Download progress bar color. The default value is `#87ceeb`. | `string` |
40
- | `showPageTooltip` | Whether to show page tooltips. The default value is `true`. | `boolean` |
41
- | `showBackToTopBtn` | Whether to show back to the top button. The default value is `true`. | `boolean` |
42
- | `scrollThreshold` | Scrolling distance over how much to display the back to top button. The default value is `300`. | `number` |
43
- | `pdfWidth` | pdf page width. The default value is `100%`. | `string` |
44
- | `rowGap` | Line spacing between pdf pages. The default value is `8`. | `number` |
45
- | `page` | Controls the current page number, and supports responsive variables to dynamically change the page number. The default value is `1` | `number` |
46
- | `cMapUrl` | Custom cMapUrl. The default value is `https://unpkg.com/pdfjs-dist@3.7.107/cmaps/` | `string` |
47
- | `httpHeaders` | Basic authentication headers. | `object` |
48
- | `withCredentials` | Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers. The default is `false`. | `boolean` |
49
- | `password` | For decrypting password-protected PDFs. | `string` |
50
- | `useSystemFonts` | When `true`, fonts that aren't embedded in the PDF document will fallback to a system font. The default value is `true` in web environments and `false` in Node.js; unless `disableFontFace === true` in which case this defaults to `false` regardless of the environment (to prevent completely broken fonts). | `boolean` |
51
- | `stopAtErrors` | Reject certain promises, e.g. `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated PDF data cannot be successfully parsed, instead of attempting to recover whatever possible of the data. The default value is `false`. | `boolean` |
52
- | `disableFontFace` | By default fonts are converted to OpenType fonts and loaded via the Font Loading API or `@font-face` rules. If disabled, fonts will be rendered using a built-in font renderer that constructs the glyphs with primitive path commands. The default value is `false` in web environments and `true` in Node.js. | `boolean` |
53
- | `disableRange` | Disable range request loading of PDF files. When enabled, and if the server supports partial content requests, then the PDF will be fetched in chunks. The default value is `false`. | `boolean` |
54
- | `disableStream` | Disable streaming of PDF file data. By default PDF.js attempts to load PDF files in chunks. The default value is `false`. | `boolean` |
55
- | `disableAutoFetch` | Disable pre-fetching of PDF file data. When range requests are enabled PDF.js will automatically keep fetching more data even if it isn't needed to display the current page. The default value is `false`. NOTE: It is also necessary to disable streaming, see above, in order for disabling of pre-fetching to work correctly. | `boolean` |
56
- | `adInterval` | Show ad after every N pages. (e.g. 10 means show ad after each 10 pages) | `number` |
57
- | `adContent` | HTML or script content to show as the ad block. | `string` |
58
-
59
- ### `Events`
60
-
61
- | Event Name | Description | Parameters |
62
- | :----------------: | :---------- | :----------------------------------: |
63
- | `onProgress` | listen to the pdf download progress, the parameters for `0-100`. | `loadRatio: number` |
64
- | `onComplete` | pdf download complete. | `-` |
65
- | `onScroll` | Listen to the pdf scrolling, the parameter is the current `scrollTop` value. | `scrollOffset: number` |
66
- | `onPageChange` | Listen for page number changes. | `page: number` |
67
- | `onPdfInit` | pdf is init. PDFDocumentProxy: https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib-PDFDocumentProxy.html | `pdf: PDFDocumentProxy` |
68
-
69
- ### `Slots`
70
-
71
- | Slot Name | Description | Parameters |
72
- | :----------------: | :---------- | :----------------------------------: |
73
- | `progress` | Customized progress bar | `loadRatio: number` |
74
- | `pageTooltip` | Customized page tooltips | `currentPage: number, totalPages: number` |
75
- | `backToTopBtn` | Customize the Back to Top button | `scrollOffset: number` |
1
+ # pdf-vue3
2
+
3
+ vue3 pdf viewer
4
+
5
+ example: <https://hymhub.github.io/pdf-vue3/>
6
+
7
+ <img src="./pdf-vue3-demo.gif" style="width: 375px;" />
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm i pdf-vue3
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```vue
18
+ <script setup>
19
+ import PDF from "pdf-vue3";
20
+ </script>
21
+
22
+ <template>
23
+ <PDF src="/demo.pdf" />
24
+ <!-- <PDF :src="BASE64" /> -->
25
+ <!-- <PDF :src="Uint8Array" /> -->
26
+ </template>
27
+ ```
28
+
29
+ ## Config API
30
+
31
+ ### `Props`
32
+
33
+ | Attribute | Description | Type |
34
+ | :----------------: | :---------- | :----------------------------------: |
35
+ | `src` | The URL or binary data(Uint8Array) or BASE64-encoded of the PDF. | `string` \| `Uint8Array` \| `BASE64` |
36
+ | `showProgress` | Whether to download the progress bar. The default value is `true`. | `boolean` |
37
+ | `progressColor` | Download progress bar color. The default value is `#87ceeb`. | `string` |
38
+ | `showPageTooltip` | Whether to show page tooltips. The default value is `true`. | `boolean` |
39
+ | `showBackToTopBtn` | Whether to show back to the top button. The default value is `true`. | `boolean` |
40
+ | `scrollThreshold` | Scrolling distance over how much to display the back to top button. The default value is `300`. | `number` |
41
+ | `pdfWidth` | pdf page width. The default value is `100%`. | `string` |
42
+ | `rowGap` | Line spacing between pdf pages. The default value is `8`. | `number` |
43
+ | `page` | Controls the current page number, and supports responsive variables to dynamically change the page number. The default value is `1` | `number` |
44
+ | `cMapUrl` | Custom cMapUrl. The default value is `https://unpkg.com/pdfjs-dist@3.7.107/cmaps/` | `string` |
45
+ | `httpHeaders` | Basic authentication headers. | `object` |
46
+ | `withCredentials` | Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers. The default is `false`. | `boolean` |
47
+ | `password` | For decrypting password-protected PDFs. | `string` |
48
+ | `useSystemFonts` | When `true`, fonts that aren't embedded in the PDF document will fallback to a system font. The default value is `true` in web environments and `false` in Node.js; unless `disableFontFace === true` in which case this defaults to `false` regardless of the environment (to prevent completely broken fonts). | `boolean` |
49
+ | `stopAtErrors` | Reject certain promises, e.g. `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated PDF data cannot be successfully parsed, instead of attempting to recover whatever possible of the data. The default value is `false`. | `boolean` |
50
+ | `disableFontFace` | By default fonts are converted to OpenType fonts and loaded via the Font Loading API or `@font-face` rules. If disabled, fonts will be rendered using a built-in font renderer that constructs the glyphs with primitive path commands. The default value is `false` in web environments and `true` in Node.js. | `boolean` |
51
+ | `disableRange` | Disable range request loading of PDF files. When enabled, and if the server supports partial content requests, then the PDF will be fetched in chunks. The default value is `false`. | `boolean` |
52
+ | `disableStream` | Disable streaming of PDF file data. By default PDF.js attempts to load PDF files in chunks. The default value is `false`. | `boolean` |
53
+ | `disableAutoFetch` | Disable pre-fetching of PDF file data. When range requests are enabled PDF.js will automatically keep fetching more data even if it isn't needed to display the current page. The default value is `false`. NOTE: It is also necessary to disable streaming, see above, in order for disabling of pre-fetching to work correctly. | `boolean` |
54
+ | `adInterval` | Show ad after every N pages. (e.g. 10 means show ad after each 10 pages) | `number` |
55
+ | `adContent` | HTML or script content to show as the ad block. | `string` |
56
+
57
+ ### `Events`
58
+
59
+ | Event Name | Description | Parameters |
60
+ | :----------------: | :---------- | :----------------------------------: |
61
+ | `onProgress` | listen to the pdf download progress, the parameters for `0-100`. | `loadRatio: number` |
62
+ | `onComplete` | pdf download complete. | `-` |
63
+ | `onScroll` | Listen to the pdf scrolling, the parameter is the current `scrollTop` value. | `scrollOffset: number` |
64
+ | `onPageChange` | Listen for page number changes. | `page: number` |
65
+ | `onPdfInit` | pdf is init. PDFDocumentProxy: https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib-PDFDocumentProxy.html | `pdf: PDFDocumentProxy` |
66
+
67
+ ### `Slots`
68
+
69
+ | Slot Name | Description | Parameters |
70
+ | :----------------: | :---------- | :----------------------------------: |
71
+ | `progress` | Customized progress bar | `loadRatio: number` |
72
+ | `pageTooltip` | Customized page tooltips | `currentPage: number, totalPages: number` |
73
+ | `backToTopBtn` | Customize the Back to Top button | `scrollOffset: number` |
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "pdf-ysk-vue3",
3
- "version": "1.0.0",
4
- "description": "vue3 pdf viewer",
5
- "main": "./dist/pdf-vue3.js",
6
- "types": "./dist/types/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/types/index.d.ts",
10
- "import": "./dist/pdf-vue3.js"
11
- }
12
- },
13
- "scripts": {
14
- "tsc": "vue-tsc --noEmit && vue-tsc --emitDeclarationOnly --allowJs",
15
- "build": "vite build && npm run tsc",
16
- "postinstall": "npx vite build && npm run tsc"
17
- },
18
- "files": [
19
- "dist"
20
- ],
21
- "type": "module",
22
- "repository": {
23
- "type": "git",
24
- "url": "git+https://github.com/hymhub/pdf-vue3.git"
25
- },
26
- "author": "hyminghan",
27
- "license": "MIT",
28
- "bugs": {
29
- "url": "https://github.com/hymhub/pdf-vue3/issues"
30
- },
31
- "homepage": "https://github.com/hymhub/pdf-vue3#readme",
32
- "keywords": [
33
- "pdf-vue3",
34
- "pdf",
35
- "vue.js",
36
- "viewer"
37
- ],
38
- "devDependencies": {
39
- "@vitejs/plugin-vue": "4.2.3",
40
- "pdfjs-dist": "3.7.107",
41
- "vite": "^4.3.9",
42
- "vue": "3.3.4",
43
- "vue-tsc": "1.8.0"
44
- }
45
- }
1
+ {
2
+ "name": "pdf-ysk-vue3",
3
+ "version": "1.0.1",
4
+ "description": "vue3 pdf viewer",
5
+ "main": "./dist/pdf-vue3.js",
6
+ "types": "./dist/types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/types/index.d.ts",
10
+ "import": "./dist/pdf-vue3.js"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "tsc": "vue-tsc --noEmit && vue-tsc --emitDeclarationOnly --allowJs",
15
+ "build": "vite build && npm run tsc",
16
+ "postinstall": "npx vite build && npm run tsc"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "type": "module",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/mohamedabdelmaksoud2000/pdf-ysk-vue3.git"
25
+ },
26
+ "author": "hyminghan",
27
+ "license": "MIT",
28
+ "bugs": {
29
+ "url": "https://github.com/mohamedabdelmaksoud2000/pdf-ysk-vue3/issues"
30
+ },
31
+ "homepage": "https://github.com/mohamedabdelmaksoud2000/pdf-ysk-vue3#readme",
32
+ "keywords": [
33
+ "pdf-vue3",
34
+ "pdf",
35
+ "vue.js",
36
+ "viewer"
37
+ ],
38
+ "devDependencies": {
39
+ "@vitejs/plugin-vue": "4.2.3",
40
+ "pdfjs-dist": "3.7.107",
41
+ "vite": "^4.3.9",
42
+ "vue": "3.3.4",
43
+ "vue-tsc": "1.8.0"
44
+ }
45
+ }
File without changes