Back

fetching pdf

  • 0
  • Flutter
Joshima
9 Aug, 2023, 15:20

i uploaded pdf same as i did with uplaoding images and now i wanna fetch it and display it but i only have the link of that file which is - $APPWRITE_ENDPOINTS/storage/buckets/$APPWRITE_FILES_BUCKET/files/$fileId/view?project=$APPWRITE_PROJECT_ID&mode=admin

TL;DR
The user is trying to fetch and display a PDF file in a Flutter app. They have tried using a PDFView package, but it requires a file path and is showing a blank screen when they provide the file link. They want to be able to view the PDF before downloading it. One suggestion is to use the "Get File for Download" method instead of the "Get File for View" method. No solution is provided in the thread.
safwan
9 Aug, 2023, 15:21

And what's the issue?

Joshima
9 Aug, 2023, 17:06

I mean how can i display that pdf file

Joshima
9 Aug, 2023, 17:07

I tried using a pdfview package but it needs filepath which is just showing blank screen if i am providing the link to that filepath

safwan
9 Aug, 2023, 17:10

Have you tried using the Get File for Download instead of the Get File for View method?

Joshima
9 Aug, 2023, 17:10

Isn’t there any way so that the user can see the file before downloading it

safwan
9 Aug, 2023, 17:12

Viewing and Downloading is basically the same thing. Even in Appwrite, the only difference difference is that when you use download, the response comes with a Content-Disposition: attachment header, which instructs the browser to download the file

Joshima
9 Aug, 2023, 17:13

Okay i will try to do that

safwan
9 Aug, 2023, 17:15

Mind if I ask which package you're using for the pdf?

Joshima
9 Aug, 2023, 17:40

flutterpdfview

Joshima
9 Aug, 2023, 18:46

i am providing link to PDFView CarouselSlider( items: fileLinks.map((link) { return Container( width: MediaQuery.of(context).size.width, margin: const EdgeInsets.all(10), child: PDFView( filePath: link, ), ); }).toList(), options: CarouselOptions(height: 400, enableInfiniteScroll: false), );

Joshima
9 Aug, 2023, 18:48

and i am sure that there is nothing wrong with the link

Drake
9 Aug, 2023, 18:55

btw it's best to use 3 backticks for multi line code

Drake
9 Aug, 2023, 18:56

There's not much else on the Appwrite side for this. If your library requires a file path, you must download and supply a file path

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more