Which product are you using?
PDF.js Express Plus
PDF.js Express Version
8.7.2
Detailed description of issue
PDF is not rendering ,instead throwing error of:
1)Exception: Message: PDF header not found.The file is not a valid PDF document.
2)on console: Uncaught (in promise) :type: “InvalidPDF”
Expected behaviour
{All pdf should render on our browser}
Does your issue happen with every document, or just one?
{Every document}
Link to document
{Present on local storage}
Code snippet
BELOW IS THE CODE:
import React from “react”;
import WebViewer from “@pdftron/pdfjs-express”;
export default function App() {
const viewer = React.useRef(null);
const funView = () => {
WebViewer(
{
path: “WebViewer/lib”,
initialDoc: “/files/demo.pdf”,
extension: “pdf”,
},
viewer.current
).then((instance) => {
instance.UI.setTheme(“dark”);
instance.UI.disableElements([“leftPanel”, “leftPanelButton”]);
instance.Core.documentViewer.addEventListener(“documentLoaded”, () => {
const rectangleAnnot =
new instance.Core.Annotations.RectangleAnnotation();
rectangleAnnot.PageNumber = 1;
rectangleAnnot.X = 100;
rectangleAnnot.Y = 150;
rectangleAnnot.Width = 200;
rectangleAnnot.Height = 50;
instance.Core.annotationManager.addAnnotation(rectangleAnnot);
});
});
};
return (
<button
onClick={() => {
funView();
}}
>
View
<div style={{ height: “auto”, overflowY: “auto” }}>
<div
className=“webviewer”
style={{ height: “51em” }}
ref={viewer}
>
);
}