MCPcopy Create free account
hub / github.com/OpenSignLabs/OpenSign / fetchPdfMetadata

Function fetchPdfMetadata

apps/OpenSign/src/pages/DebugPdf.jsx:57–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 useEffect(() => {
56 if (pdf && pdf.name) {
57 const fetchPdfMetadata = async () => {
58 try {
59 const pdfDataURL = URL.createObjectURL(pdf); // Convert File to data URL
60 // console.log("pdfDataURL ", pdfDataURL);
61 const pdfInfo = await pdfjs.getDocument({ url: pdfDataURL }).promise;
62 const pdfType = await inferPdfType(pdfInfo);
63 setPdfDetails((prevDetails) => ({
64 ...prevDetails,
65 pdftype: pdfType
66 }));
67 } catch (error) {
68 console.error("Error fetching PDF metadata:", error);
69 }
70 };
71
72 fetchPdfMetadata();
73 }

Callers 1

DebugPdfFunction · 0.85

Calls 1

inferPdfTypeFunction · 0.85

Tested by

no test coverage detected