Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with loading pdf #109

Open
selvavignesh19 opened this issue Aug 29, 2024 · 9 comments
Open

Issue with loading pdf #109

selvavignesh19 opened this issue Aug 29, 2024 · 9 comments

Comments

@selvavignesh19
Copy link

Screenshot 2024-08-29 153618

Failed to load PDF file. I just uploaded one pdf with single page , it shown like this?

@NaseerUllahAwan
Copy link

I also have this issue, but I cannot solve it with this huge internet. Any solution will be appreciated thanks!

@meshjohn
Copy link

meshjohn commented Sep 9, 2024

i found the solution change the file url to : https://utfs.io/f/${file.key} like this :
pdfUploader: f({ pdf: { maxFileSize: "4MB" } }) .middleware(async ({ req }) => { const { getUser } = getKindeServerSession(); const user = await getUser(); if (!user || !user.id) throw new Error("Unauthorized"); return { userId: user.id }; }) .onUploadComplete(async ({ metadata, file }) => { const createdFile = await db.file.create({ data: { key: file.key, name: file.name, userId: metadata.userId, url:https://utfs.io/f/${file.key}`,
uploadStatus: "PROCESSING",
},
});
}),`

@JatinSri1909
Copy link

Pdf still not loading but when I open url from prisma studio File's url attribute , it opens

@meshjohn
Copy link

Pdf still not loading but when I open url from prisma studio File's url attribute , it opens

Can you explain more or check if there's any error

@Harshpandey9156
Copy link

Same issue with me How i can fix this??

@JatinSri1909
Copy link

Pdf still not loading but when I open url from prisma studio File's url attribute , it opens

Can you explain more or check if there's any error

Actually everything is working fine excepti pdf rendering.Actually I am stuck on PDF renderding section of the tutorial. I can save my pdf in the database. After saving it I get utfs link in db, which is opened in my browser when I copy and paste link. But when I tried to render pdf it doesn't work.

@Abdullah-dev0
Copy link

change the import to
"pdfjs.GlobalWorkerOptions.workerSrc = //unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs;"

@galsever
Copy link

make sure you have node version 22 installed

@coolchigi
Copy link

I think it'll best to show steps to reproduce the error as well as the error messages you see when you inspect the browser. For my file renderer component, I remember using the following and it worked

pdfjs.GlobalWorkerOptions.workerSrc = new URL(
  "pdfjs-dist/build/pdf.worker.min.mjs",
  import.meta.url
).toString();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants