|
| 1 | +<div align="center"> |
| 2 | + <a href="https://www.embedpdf.com"> |
| 3 | + <img alt="EmbedPDF logo" src="https://www.embedpdf.com/logo-192.png" height="96"> |
| 4 | + </a> |
| 5 | + |
| 6 | + <h1>EmbedPDF</h1> |
| 7 | + |
| 8 | + <!-- Badges --> |
| 9 | + |
| 10 | +<a href="https://github.com/embedpdf/embed-pdf-viewer/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@embedpdf/pdfium.svg?style=for-the-badge&labelColor=000000"></a> |
| 11 | +<a href="https://github.com/embedpdf/embed-pdf-viewer/discussions"><img alt="Join the community on GitHub" src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&labelColor=000000"></a> |
| 12 | + |
| 13 | +</div> |
| 14 | + |
| 15 | +# Vue Quasar PDF Viewer Example |
| 16 | + |
| 17 | +This example shows how to build a fully‑featured PDF viewer with **EmbedPDF**, **Vue 3** and **Quasar 2**. It demonstrates how to combine EmbedPDF’s plugin system with Quasar components to create a polished reading experience that feels right at home in any Vue + Quasar project. |
| 18 | + |
| 19 | +- **Live demo:** _(coming soon)_ |
| 20 | +- **Docs:** [https://www.embedpdf.com](https://www.embedpdf.com) |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Key features on display |
| 25 | + |
| 26 | +| Feature | Plugin(s) | |
| 27 | +| ---------------------------------------------------------- | --------------------------------------------------------------------------------- | |
| 28 | +| Virtualised scrolling with smooth page rendering | `@embedpdf/plugin-scroll` + `@embedpdf/plugin-render` + `@embedpdf/plugin-tiling` | |
| 29 | +| Zoom controls (fit page, fit width, marquee zoom, presets) | `@embedpdf/plugin-zoom` | |
| 30 | +| Pan/hand tool | `@embedpdf/plugin-pan` | |
| 31 | +| Rotate pages | `@embedpdf/plugin-rotate` | |
| 32 | +| Single and spread layouts | `@embedpdf/plugin-spread` | |
| 33 | +| In‑document text search | `@embedpdf/plugin-search` | |
| 34 | +| Thumbnail sidebar navigation | `@embedpdf/plugin-thumbnail` | |
| 35 | +| Annotation tools (text, shapes, stamp) | `@embedpdf/plugin-annotation` | |
| 36 | +| Redaction tools (text selection, marquee) | `@embedpdf/plugin-redaction` | |
| 37 | +| File picker, download & print | `@embedpdf/plugin-loader`, `@embedpdf/plugin-export`, `@embedpdf/plugin-print` | |
| 38 | +| Fullscreen support | `@embedpdf/plugin-fullscreen` | |
| 39 | + |
| 40 | +The UI around these plugins is built with Quasar’s `QHeader`, `QDrawer`, `QMenu`, `QBtn`, and companion components. On mobile, the side drawers collapse into a bottom-sheet style `QDialog` for a more native feel. |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## Quick start |
| 45 | + |
| 46 | +> **Prerequisites** |
| 47 | +> |
| 48 | +> - Node 18 or newer |
| 49 | +> - **pnpm** 10 (recommended) or a recent pnpm 8/9 |
| 50 | +
|
| 51 | +1. **Clone the repo** (or your fork) and install dependencies: |
| 52 | + |
| 53 | + ```bash |
| 54 | + git clone https://github.com/embedpdf/embed-pdf-viewer.git |
| 55 | + cd embed-pdf-viewer |
| 56 | + pnpm install |
| 57 | + ``` |
| 58 | + |
| 59 | +2. **Build the core packages** once so that the example can import them: |
| 60 | + |
| 61 | + ```bash |
| 62 | + pnpm run build --filter "./packages/*" |
| 63 | + # or keep them rebuilt automatically while you work: |
| 64 | + pnpm watch build --filter "./packages/*" |
| 65 | + ``` |
| 66 | + |
| 67 | +3. **Run the example dev server**: |
| 68 | + |
| 69 | + ```bash |
| 70 | + pnpm --filter @embedpdf/example-vue-quasar run dev |
| 71 | + ``` |
| 72 | + |
| 73 | + Vite will start on [http://localhost:3000](http://localhost:3000) and open the browser automatically. |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Building a production bundle |
| 78 | + |
| 79 | +To create an optimized build (under `examples/vue-quasar/dist`): |
| 80 | + |
| 81 | +```bash |
| 82 | +pnpm --filter @embedpdf/example-vue-quasar run build |
| 83 | +``` |
| 84 | + |
| 85 | +The output is a static site you can deploy to any CDN or static host. |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +## Folder layout |
| 90 | + |
| 91 | +``` |
| 92 | +examples/vue-quasar |
| 93 | +├── public/ # Static assets (favicon) |
| 94 | +└── src/ |
| 95 | + ├── components/ # Quasar‑based UI parts (Toolbar, Search, …) |
| 96 | + │ └── drawer-system/ # Reusable logic for side drawers/bottom sheets |
| 97 | + ├── plugins/ # Quasar plugin setup |
| 98 | + ├── App.vue # Root Vue component |
| 99 | + ├── Application.vue # Main viewer shell and plugin wiring |
| 100 | + └── main.ts # Vue entry + theming |
| 101 | +``` |
| 102 | +
|
| 103 | +The PDFium WebAssembly bundle is loaded automatically by the `usePdfiumEngine` hook in `src/Application.vue`, which passes it to EmbedPDF’s **WebWorkerEngine**. |
| 104 | +
|
| 105 | +--- |
| 106 | +
|
| 107 | +## Customisation tips |
| 108 | +
|
| 109 | +- **Swap icons or colours:** The UI uses standard Quasar components and props, so styling tweaks are straightforward. |
| 110 | +- **Add or remove plugins:** Open `src/Application.vue` and edit the `plugins` array. |
| 111 | +
|
| 112 | +For deep dives, check the [EmbedPDF documentation](https://www.embedpdf.com) and the source of this example. |
| 113 | +
|
| 114 | +--- |
| 115 | +
|
| 116 | +## License |
| 117 | +
|
| 118 | +Example code is released under the MIT license, the same as EmbedPDF itself. |
0 commit comments