Hi , I have implemented WebViewer Version but it is not working . I have implemented same as demo code
import React, { useRef, useEffect } from ‘react’
import WebViewer from ‘@pdftron/webviewer’
import ‘./DocViewer.css’
import { useSearchParams } from ‘react-router-dom’
const DocViewer = () => {
debugger
const viewer = useRef(null)
const instance = useRef()
const [searchParams] = useSearchParams()
const defaultPath = ‘/files/PDFTRON_about.pdf’
const queryPath = searchParams.get(‘path’)
var path =
queryPath === undefined || queryPath === ‘’ || queryPath == null
? defaultPath
: queryPath
// if using a class, equivalent of componentDidMount
useEffect(() => {
WebViewer(
{
// path: ‘/webviewer/lib’,
// initialDoc: path,
// fullAPI: true,
path: '../../../lib',
webviewerServerURL: 'https://demo.pdftron.com/',
initialDoc:
'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',
},
viewer.current,
).then((inst) => {
const {
documentViewer,
annotationManager,
Annotations,
Search,
} = inst.Core
const { Feature } = inst.UI
inst.UI.enableFeatures([Feature.FilePicker])
//samplesSetup(inst)
document.getElementById('select').onchange = (e) => {
inst.UI.loadDocument(e.target.value)
}
document.getElementById('file-picker').onchange = (e) => {
const file = e.target.files[0]
if (file) {
inst.UI.loadDocument(file)
}
}
document.getElementById('url-form').onsubmit = (e) => {
e.preventDefault()
inst.UI.loadDocument(document.getElementById('url').value)
}
})
}, [path])
return (
)
}
export default DocViewer