PDF source not found
- 主要語言
- TypeScript
- 星號
- 395
- 分支
- 39
- 平均合併
- 7 小時 7 分鐘
- 30 天內合併 PR
- 12
描述
I tried to search it in documentation, but didn't found any information about it. Is there any API handler, if PDF resource is not found? Similar like loading state? If source not found, i would like to inform that PDF file is not found. Currently I am just stuck in loading state.

```
"use client";
import {
Root,
Pages,
Page,
CanvasLayer,
ZoomOut,
CurrentZoom,
ZoomIn,
} from "@anaralabs/lector";
import { GlobalWorkerOptions } from "pdfjs-dist";
import "pdfjs-dist/web/pdf_viewer.css";
import { useEffect, useState } from "react";
import { loadApsLocation } from "@/actions/job-all-actions";
import "pdfjs-dist/web/pdf_viewer.css";
// @ts-ignore
import * as PDFJS from "pdfjs-dist/build/pdf.min.mjs";
const workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${PDFJS.version}/pdf.worker.min.mjs`;
PDFJS.GlobalWorkerOptions.workerSrc = workerSrc;
// Set up the worker
GlobalWorkerOptions.workerSrc = workerSrc;
type Props = {
apsId: number;
};
const fileServer: string = process.env.NEXT_PUBLIC_FILE_SERVER!;
const NewFullPdfViewer = ({ apsId }: Props) => {
const [location, setLocation] = useState(null);
const loadLocation = async () => {
const apsLocation = await loadApsLocation(apsId);
if (apsLocation === "NONE") {
setLocation("NONE");
} else {
setLocation(fileServer + apsLocation);
}
};
useEffect(() => {
loadLocation();
}, []);
if (!location) {
return
loading...
;}
return (
Loading...}
zoomOptions={{ minZoom: 0.5, maxZoom: 3.0 }}
zoom={2.0}
>
Zoom
-
+
);
};
export default NewFullPdfViewer;
```
貢獻指南
評估
這個 Issue 還沒有評估資料。