href pdf file url is not found when click on it - node.js

I'm working on the vuejs application and, I'm receiving the pdf file from node backend which has the eg url https:abc.com/api/filename.pdf.
I'm using it link so
const myUrlVariable='https://someurl.com/dataCollection/imperial'
<a :href="myUrlVariable" target="_blank"></a>
The requirement of this is to when user click on link, file should open in the new tab.
But Right now when I click on the link its considering it as application route and show the message page not found, instead it show the pdf file.
I check this link in the postman and its returning the file as expected.

href should not be a string, but a binding to a variable
Change this
to this
<a :href="myUrlVariable" target="_blank"></a>
👆
Is the url correct?
https:abc... -> https://abc...

Related

How To Open a new Tab by passing some argument into URL

If somebody click on link that should have some parameters in url to open the link in new tab.
for example : www.youtube.com/c/devtechsolutions
will just navigate to this link.
What if I would like to open this link in new tab, just by modifying the url with someparameters.
Only url has to be modified.

Dynamic Link not opening web browser url

So when opening the dynamic link I get the error- Requested URL must be a parseable URI, but possibly incomplete to be a DynamicLink.
I have the app store link attached to it. How do I fix this?
Say my dynamic link is https://example.page.link and my URL is https://example.page.link/abcd.
DynamicLink dynamicLink = FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("https://exmaple.page.link/"))
.setDomainUriPrefix("https://example.page.link/")
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder().build())
.buildDynamicLink();
dynamicLinkUri = dynamicLink.getUri();
But when I add abcd in setDomainUriPrefix() then the post in the app doesn't open, though the link opens in the browser.
DynamicLink dynamicLink = FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("https://exmaple.page.link/"))
.setDomainUriPrefix("https://example.page.link/abcd")
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder().build())
.buildDynamicLink();
And when I receive this link, the url always shows as the playstore link, hence it doesn't open the app post. How can I fix this?
dynamicLinkUri = dynamicLink.getUri();

How can i give link to download(not open) pdf file in reactjs

this is my code which i am writing in render method, which works fine, but instead of downloading this file it's opening in browser.
download
How can i give a link in react to force download a file, file which is coming from external server.
HTML5
<a download href="file.pdf">Download PDF</a>
Suppose you have a variable names as "link" in which the link is stored. So you can do,
<a href={`${link}`} type="application/pdf; download='some_pdf_name'>Download</a>

Google docs viewer not working

Using this code:
<iframe height="780" src="http://docs.google.com/viewer?url=http://ruh.kz/sites/default/files/doc/ritorika.pdf&embedded=true" style="border: none;" width="600"></iframe>
But all the time im getting this annoying message:
Sorry, we are unable to retrieve the document for viewing or you don't have permission to view the document.
By the way, i have read about ISP might block google docs. But i've checked another sites with google docs viewer and they seemed to work perfectly.
to embed your pdf without putting it in your server , just login to your gmail and upload it in google docs then copy the link and put it in your iframe's src
first you try with online version to view your file if it shows your file,you gave wrong url to iframe,if viewer does not show your file at embedded version and online version check your file size,file url and file permissions to viewer can reach your document.You can try your url, for example http://www.foo.com/bar.pdf paste in your browser,if url is right browser shows the file...

Download link page JSF

How can I produce a URL which somebody could open and that would immediately download a file e.g. pdf?
I have been using ice:outputResource but that requires the user clicks on a link. Is it possible to do this in JSF?
Thanks,
Dwayne
You want to download a PDF file immediately when one opens a page? Use Javascript to fire the request on the PDF file during page load.
<script>
window.onload = function() {
window.location = 'http://example.com/context/path/to/file.pdf';
}
</script>
Update: your question is actually ambiguous. From other point of view, are you asking how to return a PDF file on a GET request? If so: if it's a static PDF file, then just put the PDF somewhere in the webcontent and link to it. Or if it's to be dynamically generated or served from a database or local disk file system outside the webapp, then create a servlet which does the job. Example here.

Resources