open PDF file in the browser window using angularjs - angularjs

I have PDF file located in the local file system,
local file path:
C:\pdf\sample.pdf
How do i open the pdf file in the browser using angularjs.

I hope it may help just follow the instructions and there is an example in the zip file try it.
http://ngmodules.org/modules/ng-pdfviewer

Related

How do I download a file on click in reactjs from download Url firebase storage?

This is what I implemented:
downloadFile=(file)=>{
var element=document.createElement('a');
element.style.display= "none";
element.setAttribute('href', file.fileUrl)
element.setAttribute("target", "_blank");
document.body.appendChild(element)
element.click()
document.body.removeChild(element)
}
This is working fine for .ai files but not for .pdf or .jpeg. Instead of downloading the file, the browser opens it in a separate window. I want to enable download file feature and not open file. How do I fix this issue? Is there an alternative way to download the file from url from browser?
Try to use download attribute instead of href.
See element a DOC.

How can I download zip file using angularjs

I am using angularjs.I am getting zip file URL from the server.
I am using below code to download my file.
Example 1
Filename comes from the angular controller.
From the above code I will be able to download the file but in the download folder.How can I download that file in specified location ?
just open that link in new tab it will automatically be download.
window.open(wholeURLToDownload);

Download file in ionic application

I'm creating an app with ionicframework. I want that the user can downolad pdf files which are in the app. In which folder i must place the files, in template folder? How can the user download the files, i must use < a ui-sref="file.pdf" >< /a >?
Thank you.
If your PDF files are in the application, you could save them in temporary filesystem and after open with default app (move them).
To get access to the device’s files and directories, you need work with plugin $cordovaFile (http://ngcordova.com/docs/plugins/file/). Here you will find the file system layout.
To open a file on your device with its default application use $cordovaFileOpener2 (http://ngcordova.com/docs/plugins/fileOpener2/)
I'm trying don't move file.
I used InAppBrowser plugin (in ionic 2 project) and i have a 'a.pdf' file in 'www' folder. i use this code:
In .js file:
> openURL(url) {
> InAppBrowser.open(url,'_system','location=yes'); }
In .html file:
<button (click)="openURL('a.pdf')">Open pdf
</button>
When i press on button the device ask me to select a program to open file, then i select adobe reader pdf. But adobe reader pdf tells me 'impossible to load file ...'.
What is the right path (url) to call openURL(url)?
Thank you.

View PDF file internally into the app from local folder by using inappbrowser

I am developing an app for ipad using
ionic framework
I am stuck at one point were
i want to open a PDF file using inappbrowser from an local folder
So that the user can read the PDF internally. The PDF is kept in local folder were my HTML file is available and i am trying to open it through below code:
window.open('pdf-sample.pdf', '_blank', 'location=yes');
But the issue is when i am trying to open it i am
not able to view/read the PDF file
It shows me the white blank screen with no content in it.
Screenshot:
What should i do to resolve this issue?
-thanks
The code looks ok. Try to open https://www.google.com/. If that works than the path to pdf is not correct.
Are you sure you try to open after deviceready ?

phonegap - where is the file saved?

I'm want to save an file with text in my phonegap app. I'm using the exaple code from phonegap - FileWriter_full_example.
Where is the file readme.txt located after writing? When I'm seraching after 'renamed.txt' at the windows explorer i get an not found error.
The File gets stored in sdcard.
Go to File Explorer--->mnt---->sdcard
And you will get the file there...

Resources