i am not able to deliver pdf to react page
i have free plan in cloudinary. i want to upload pdfs in my react webpage but i am not able to do so. whenever i paste url generated from mongodb in chrome, it shows failed to load pdf document
. can you please suggest me anything that could help me.it is very urgent project which i need to submit in coming three days.
i have also cleared cache of my laptop.
i have ticked this option also in settings:
Allow delivery of PDF and ZIP files
for reference here is one of the URL:
http://res.cloudinary.com/dnboura9t/image/upload/v1733561165/xdxdnfbmaxbxtbbkccsu.pdf
Best Answer
-
Hey @rmn. Thanks for getting in touch.
That PDF loads just fine for me across multiple devices, so I suspect what happens is you attempted to load the PDF before allowing PDF/ZIP delivery, and so the error response is cached locally. I appreciate you mentioned having cleared the cache, but are you able to open the PDF in another browser, or device such as your phone?
If so, you may need to look at clearing your cache once again in order to get delivery to work. Alternatively, you may be able to try increasing the version number used in your delivery URL to effectively bypass the cache.
Could you please give this a try and let us know how it goes?
Many thanks,
-Danny0
Answers
-
@DannyFromCloudinary thank you so much for fast reply but as per your suggestions:
i have loaded the file after allowing pdf/zip delivery and , i have cleared all cache again from browser and system. i have opened same link in my mobile device,but it is not opening there also. it shows white blank screen.
i have put f_auto instead of version number and only first page of pdf was shown
http://res.cloudinary.com/dnboura9t/image/upload/f_auto/xdxdnfbmaxbxtbbkccsu.pdf
but i need to show full pdf and that too in my webpage. this page is shown only when i manually take link and edit it
but nothing worked for me.
can you please kindly suggest me something else
0 -
Ah, I see what's happening here. When you're using f_auto, we're converting the PDF into a in image format (on my machine, a webp), which renders just the first page.
To deliver as a PDF, you should be able to use the URL without any transformation:
https://res.cloudinary.com/dnboura9t/image/upload/xdxdnfbmaxbxtbbkccsu.pdfIf that doesn't work, you could try forcing PDF as a format with
f_pdf
like so:
https://res.cloudinary.com/dnboura9t/image/upload/f_pdf/xdxdnfbmaxbxtbbkccsu.pdf0 -
i have tried f_pdf already but same result
i have also used {page:"1-"} or {pages:true} but not worked
but using f_format how can i render all pages.
meanwhile this is error i get in console
GET https://res.cloudinary.com/dwreyfb3h/image/upload/v1733586480/tt4s2crssjk9ctb20zf0.pdf 401 (Unauthorized)meanwhile i used resource type as "raw" also but it directly downloads the pdf into my laptop
0 -
Hi there,
On my side everything looks good, I would recommend checking to see whether it is a cached issue or not by attempting to deliver a new novel transformed version ex:
https://res.cloudinary.com/dwreyfb3h/image/upload/x_0/tt4s2crssjk9ctb20zf0.pdf
If it does deliver you can invalidate the cache of the asset, you can find instructions to do so via our documentation.
https://cloudinary.com/documentation/invalidate_cached_media_assets_on_the_cdn
If you still are running into issues I would ask you to open a support ticket so that we can investigate the issue in more detail.
Thanks!0 -
thanksfor your reply…
heres what i did again:
i just cleared all my laptop cache again. it showed pdf for just two or some time. then it again showed me same error. 😓
0 -
Hi there,
This sounds very strange indeed and seems most likely an issue with either a firewall or some sort of network related issue. I would recommend trying on a different network/device to see if you can replicate the issue and open a support ticket so that we can investigate.0 -
Hi there,
Have you tried to send it as raw?
"https://res.cloudinary.com/dwreyfb3h/raw/upload/x_0/tt4s2crssjk9ctb20zf0.pdf" could solve the issue. I hope it helps 🙌
0