1.2.3 • Published 10 months ago

pdf-viewer-root v1.2.3

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

pdf-viewer-root

This library is based on @yangxuy/pdf-reader but has some new features

Setup:

yarn add pdf-viewer-root
npm i pdf-viewer-root

Usage

vue 2 / 3:

<template>
<pdf-viewer-root :url="url" />
</template>

<script>
import "pdf-viewer-root"
</script>

react:

import pdf from "./assets/1.pdf";
import "pdf-viewer-root";
import { useRef } from "react";
import React from "react";

function App() {
    const div = useRef<any>();

    return (
        <div className="App" ref={div}>
            {React.createElement("pdf-viewer-root", { url: pdf })}
        </div>
    );
}

export default App;

component attributes

attrdescriptiondefaultTypeNot working yet
urlLink to the file (you can send a blob)string
pagePage number, from 1 to infinity1number
modeDisplay mode if 1 shows by page. If 2 shows all pages at once1number
scalepdf size on screen. from 10 to 100100number-
dpiManages the quality300number-
onSuccessWhen the pdf is loaded, this event will be called-(pdf) => {}
onErrorWhen the pdf gives an error, this event will be called-(error) => {}
debugLog info in consolefalseboolean
loadingtextText in loadingComponent'loading'string
1.2.3

10 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago