JavaScript Phonegap open PDF file - javascript

How to open PDF file without plugin?
I'm tried : window.open(path, '_blank', 'fullscreen=yes');
and opened blank page in editor.

Do you want the PDF to open inside your app, or is it OK if it's opened externally? If it's the latter:
On iOS you can just create a normal link with target="_blank" and Phonegap will open the pdf in Safari.
On Android you need to call window.open with "_system" as window name: window.open("yoururl", "_system", "location=no"); and Android will either open in the browser or start downloading (which might not be very obvious), or show the "Complete action using"-dialog if there are several options to open the file.
Of course, the downside of opening externally is that the users need to get back to your app themselves after viewing the PDF, so if you anticipate many users will view the pdf I would not recommend this solution.

Related

JavaScript: Save PDF in the 'Microsoft PDF reader'

my web app opens a PDF inside an Iframe. Users can then add texts, draw with digital ink and highlight text. As the PDF is rendered using the user's browser-engine, I recommend trying it with the latest Microsoft Edge.
I would like to save the edited PDF to the location I opened it from with the click of a button.
The PDF editor of the browser has a save feature, but users have to select the location first, and confirm that they are overwriting the file.
Is it even possible because Microsoft Edge seems to isolate the PDF process. When I open a PDF in Edge without my web app, I can simply click the save button, and it will be saved at the location I opened it.
I could not find any documentation for microsoft pdf editor and how to interact with it.
Full code of my project: https://github.com/joseftogo/PDF-Notes-Manager-Alpha
Thank you!
I agree with KJ's opinion. When you open a pdf on a website in Edge, you're actually view it online. So it's wrong to say "save the edited PDF to the location I opened it", it's not opened from local file path. If you want to save it, you're not overwriting any file on your computer, you're downloading a new file to your computer, so you have to select the location first. It's the necessary process.
For the situation you say, "When I open a PDF in Edge without my web app, I can simply click the save button, and it will be saved at the location I opened it." I think that's when you open a local pdf file in Edge. At that time, Edge is just a viewer, and the pdf is already existed on your computer so of course you can overwrite that file directly.

Can you prevent PDF javascript running when loaded in browser?

I ran into an interesting PDF file which has some custom javascript that triggers the print window function automatically when the file is opened.
The annoyance comes when the file is uploaded into a web app and every time the file is previewed or opened it fires up the print dialog.
The only information I found was about cleaning the file in a PDF creator/reader software or blocking the default print dialog on the page with javascript, but that seems to interfere with normal print options.
Has anyone run into this combination before and found a way to block the print dialog on PDF files (only) without disrupting the usual print options for the browser?

Opening a file from the default file browser on mobile device. No matter the browser

I have a web app that prompts the user to upload a file with some standard html:
However, if the user opens the link from the mini-chrome that opens links from hangouts/gmail. The file browser that is used is different from the file browser used by navigating to the page with chrome.
My question is:
Is there a way to set default file browser on the web?
I understand you can set the default application to open links in the gmail app, this is irrelevant as the user will click the link from an email and it doesn't make sense to tell them to copy the link into chrome.
Thanks in advance!

Get Firefox PDF viewer information

I have a web application written in c# that shows pdf documents.
What I do is when a user click a document, I open a new browser tab and show the pdf.
Everything works fine but in Firefox i have a boring problem.
If the PDF viewing option is set to 'Preview in Firefox' goes fine, otherwise the browser downloads the aspx page where the document should be shown.
Is it possible via javascript or c# code know what option is set and so manage the situation in a proper way?

How can I open a safari link from standalone webapp?

I'm trying to open an html page (I get it as a string and parse it) from my fullscreen iOS web application (standalone).
I tried opening a window (window.open) but it doesn't work.
It involves handling a payment method, so I can't redirect back from their page to mine (it's an illegal hack) when I finish.
How can I manage opening the html file in safari and going back?
I don't know of a way that a standalone mode web app can serve up raw HTML to the user without it being hosted somewhere.
If you have a genuine web URL though, you can have the user click a link with target="_blank" (new tab) and it should open in Safari, instead of the standalone browser. I don't think you can do it via window.open(), because it will be silently blocked as a "pop-up".

Categories