0

Why am I getting this error? And I used another library react-pdf but it shows "failed to load pdf file". and I am fetching a pdf file from aws bucket .but it showing this error i attached a photo of error as well please do help me out .

fetch_stream.js:126          
GET https://eduzuka-ebooks-bucket.s3.us-east-2.amazonaws.com/Test+pdf.pdf net::ERR_BLOCKED_BY_CLIENT

Here is my code:

import React, { useRef, useEffect } from 'react';
import WebViewer from '@pdftron/webviewer';
import './App.css';

const App = () => {
  const viewer = useRef(null);

  // if using a class, equivalent of componentDidMount 
  useEffect(() => {
    WebViewer(
      {
        path: '/webviewer/lib',
        initialDoc: 'https://eduzuka-ebooks-bucket.s3.us-east-2.amazonaws.com/Test+pdf.pdf',
      },
      viewer.current,
    ).then((instance) => {
      const { documentViewer, annotationManager, Annotations } = instance.Core;

      documentViewer.addEventListener('documentLoaded', () => {
        const rectangleAnnot = new Annotations.RectangleAnnotation({
          PageNumber: 1,
          // values are in page coordinates with (0, 0) in the top left
          X: 100,
          Y: 150,
          Width: 200,
          Height: 50,
          Author: annotationManager.getCurrentUser()
        });

        annotationManager.addAnnotation(rectangleAnnot);
        // need to draw the annotation otherwise it won't show up until the page is refreshed
        annotationManager.redrawAnnotation(rectangleAnnot);
      });
    });
  }, []);

  return (
    <div className="App">
      <div className="header">React sample</div>
      <div className="webviewer" ref={viewer}></div>
    </div>
  );
};

export default App;

please need help

0 Answers0