All Projects → vinodnimbalkar → svelte-pdf

vinodnimbalkar / svelte-pdf

Licence: MIT license
svelte-pdf provides a component for rendering PDF documents using PDF.js

Programming Languages

Svelte
593 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to svelte-pdf

pdf-viewer
PDFjs with flipbook integration (using turnjs4)
Stars: ✭ 85 (-16.67%)
Mutual labels:  pdf-viewer, pdfjs
react-pdf
Simple and fancy PDF Viewer based on pdf.js 📄⚡️
Stars: ✭ 58 (-43.14%)
Mutual labels:  pdf-viewer, pdfjs
digitalmusicstand
web based music sheet viewer (go, pdfjs) as a single binary
Stars: ✭ 22 (-78.43%)
Mutual labels:  pdf-viewer, pdfjs
svelte-fa
Tiny FontAwesome 5 component for Svelte
Stars: ✭ 214 (+109.8%)
Mutual labels:  svelte
svelte-bricks
Naive Svelte Masonry component without column balancing (ragged columns at the bottom)
Stars: ✭ 22 (-78.43%)
Mutual labels:  svelte
svelte-starter-kit
Svelte with brilliant bells and useful whistles
Stars: ✭ 384 (+276.47%)
Mutual labels:  svelte
svelteit
Svelteit is a minimalistic UI/UX component library for Svelte and Sapper projects
Stars: ✭ 64 (-37.25%)
Mutual labels:  svelte
type-kana
A quiz app to help you learn hiragana and katakana, the Japanese syllabaries
Stars: ✭ 21 (-79.41%)
Mutual labels:  svelte
focus-svelte
focus lock for svelte
Stars: ✭ 18 (-82.35%)
Mutual labels:  svelte
svelte3-translation-ru
Russian translation of the official Svelte resources
Stars: ✭ 49 (-51.96%)
Mutual labels:  svelte
mathesar
Web application providing an intuitive user experience to databases.
Stars: ✭ 95 (-6.86%)
Mutual labels:  svelte
mmss-client
No description or website provided.
Stars: ✭ 16 (-84.31%)
Mutual labels:  svelte
felt-mockup
retired mockup 💚 customizable community tools that feel good
Stars: ✭ 47 (-53.92%)
Mutual labels:  svelte
sveld
Generate TypeScript definitions for your Svelte components
Stars: ✭ 281 (+175.49%)
Mutual labels:  svelte
template-electron-svelte
Starter project with basic Svelte and Electron setup
Stars: ✭ 23 (-77.45%)
Mutual labels:  svelte
todomvc-svelte
TodoMVC built with Svelte and Store
Stars: ✭ 34 (-66.67%)
Mutual labels:  svelte
eslint-plugin-svelte
ESLint plugin for Svelte using AST
Stars: ✭ 22 (-78.43%)
Mutual labels:  svelte
SvelteScaling
Does Svelte scale?
Stars: ✭ 21 (-79.41%)
Mutual labels:  svelte
svelte-fullcalendar
A Svelte component wrapper around FullCalendar
Stars: ✭ 123 (+20.59%)
Mutual labels:  svelte
PDF4QT
All-in-one library and application for processing and rendering PDF documents. Contains document viewer/editor application, application for splitting/merging PDF documents and page manipulation, application for comparison of similar PDF documents.
Stars: ✭ 15 (-85.29%)
Mutual labels:  pdf-viewer

svelte-pdf

MadeWithSvelte.com shield npm npm

Simple svelte PDF Viewer component with controls like

  • Page navigation
  • Zoom
  • Rotation
  • Print
  • AutoFlip Page

Demo

Source code of demo page is included in example directory.

https://svelte-pdf.netlify.com

How to install

npm install svelte-pdf

How to use

<script>
	import PdfViewer from 'svelte-pdf';
</script>

<PdfViewer url='./helloworld.pdf' />

Props

prop name type default Required
url string "" Yes
scale float 1.8 No
pageNum number 1 No
flipTime number 120 No
showButtons boolean true No
showBorder boolean true No

Examples

To view the examples, clone the svelte-pdf repo and install the dependencies:

$ git clone https://github.com/vinodnimbalkar/svelte-pdf.git
$ cd example
$ npm install
$ npm run dev

Then run the http://localhost:5000:

How to use it in Sapper with SSR enabled

1. Install it as part of devDependencies

When using Svelte components installed from npm, it needs the original component source (rather than any precompiled JavaScript that ships with the component). This allows the component to be rendered server-side, and also keeps your client-side app smaller...

  -- [Rich Harris](https://github.com/Rich-Harris/svelte-workshop#using-external-components)

We have to install svelte-pdf as part of devDependencies

npm install -D svelte-pdf

...this will cause it to get bundled (and therefore compiled) with your app.

2. Make our PdfViewer component SSR compatible

Since out PdfViewer component has a dependency on window object, we have to use dynamic import, from within the onMount function (which is only called on the client), so that our import code is never called on the server. Refer to the official doc here...

<script>
  import { onMount } from "svelte";
  let PdfViewer;

  onMount(async () => {
    const module = await import("svelte-pdf");
    PdfViewer = module.default;
  });
</script>

<svelte:component this={PdfViewer} url="YOUR-PDF-URL"/>

Contributing

Feel free to open an issue (or even better, send a Pull Request). Contributions are very welcome!! 😄

License

MIT © Vinod Nimbalkar

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].