()
| 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 | } |
no test coverage detected