Edge extension - how to create downloadable content? - microsoft-edge

My Edge extension creates PDF files. What's is the best approach to provide a download capability for these files in my extension? I tried:
window.navigator.msSaveOrOpenBlob()
create link dynamically and assign data URI to the HREF field
this approach: http://html5-demos.appspot.com/static/a.download.html
None of these ways seem to work. The "Downloads" API is not available at the moment. Using the Flash script to download the file is not the best solution (it requires Flash to be enabled).
Ideal scenario is: user clicks a "Download" button, and a "Save as" dialog appears. So how do I do that in my Edge extension?

Related

Lua script in Splash - direct file download by button click

How to directly download and save a file by button click using Splash Lua?
Example page and the download button:
Conditions:
The download URL is generated dynamically upon button click
Clicking the button will open a "Save As" prompt window to save the Excel file
I am using a Splash docker service on localhost:8050. I write Lua script directly on the page.
I have searched the official docs about binary download, but the closest things I have managed to find were html:jpeg, html:png and response.body, which didn't quite seem to hit the mark. I also found no explicit examples or tutorials on Youtube.
Note: Please do not give workarounds such as using Selenium. I am only interested in how to do it with Lua.

Editing a PDF in UIDocumentInteractionController and saving..?

I've got an 'interactive PDF' that I need to be able to edit and save in an iOS app and I'm looking at how to achieve it. It's got text boxes and radio buttons which I can interact with in the UIDocumentInteractionController preview (or QLPreviewController) but there doesn't seem to be a way to save those changes to the file that was loaded and if I share the live and edited file to my mac via AirDrop it doesn't send the changes, rather it seems just the original file.
I don't really know anything about interactive PDFs so not sure how added text would normally be saved. I've found that the 'Files' app (added in iOS 11) actually saves the edits you make, so that's basically what I want to be able to do.
At the end of the day I just need a way to be able to interact with a PDF in my app and save the changes. Do I maybe need to use a custom PDF viewer rather than trying to piggy back off the standard iOS file previewer functionality?
Looks like this library solves my problem: https://github.com/derekblair/ILPDFKit
It lets you edit a PDF, access and set individual fields and save out as a static PDF.

force "save file" on download URL

I have a template file saved in my Microsoft SharePoint document library, I am using a promoted link tile (linking directly to the file in the SharePoint) to make it easier for users to download it.
Problem is, I don't want people to open the file directly, but to force them to save the file first. Is there any way to do so just by adding something in the URL ?
In HTML5, most browsers you can add a 'download' attribute to the a element.
for example:
Download
Refer: How can I create download link in html?
Yes, there it. Add "/_layouts/download.aspx?SourceURL=" after the site name.
If the direct URL is sp.contoso.com/SharedDocuments/myfile.docx, then the download URL is sp.contoso.com/_layouts/download.aspx?SourceURL=/SharedDocuments/myfile.docx

Free and easy way to dynamically update/send text to released app via internet?

I would like to be able to send text to/update a Label in my App that is already released whenever I want to via Internet. It really just needs to be a little text, like one or two sentances.
I was doing a lot of research on how to achieve this.
Twitter - use a Twitter Account to post the text and get the post from inside the app ? - Just found solutions to read the user Account that is currently using the app (but should be my own account where i can post, and that post should be shown in the app to everybody) and need to be locked in Twitter in System preferences. If you want to read "foreign" account you need to integrate fabric - sign there... very complicated... !?
Podcast ?
Just get text from anywhere via NSURLSession - I have no Website to put the text on... !?
Use Restful Service ? Is there any free web service I can just write two sentences and they could get loaded into my app?
So I am not asking about how to implement NSURLSession or so, I just wonder what would be the easiest and free way to provide text somewhere in some format from where my app could download the text and update a label? I don t really want to pay for a service or a website just to write two sentances from time to time, from where I could download it into my app...
Thanks for ideas
One option would be to put a text file in a Github repo. Github provides a link to the raw file, so your app could pull from that URL.
If you want to do this through the web interface, you can follow these steps:
Create an account on github.com, and log in.
Click the plus (+) in the upper right to add a new repository.
Pick any name for "Repository name".
Check "Initialize this repository with a README". You need this to make it easy to edit online.
Click the green "Create repository" button.
Click "Create new file".
Fill in the file name.
Enter whatever text you want for your app in the body of the file.
Click the green "Commit" button at the bottom.
Whenever you want to edit the file, you can click on the file name and then click the pencil to edit it.
You can get the link to the file by clicking the "Raw" button (when viewing the file) and copying the URL from your URL bar. It should be something like https://raw.githubusercontent.com/<username>/<repo>/blob/master/<filename>.

What is the best way to manipulate an existing PDF-Document under iOS?

I need to individualize documents within an iOS-App. I could provide the origin-documents as DOCX, PDF, PPT etc. The output-format has to be PDF.
My minimun requirement is to fill some text-fields. Nice to have would be to replace an image, too.
I´m quite used to generate PDFs programmatically using UIGraphicsBeginPDFContextToFile etc. But in my current case I don´t want to create the whole document programmatically, I just want to replace some content.
Any hints / tipps?
Thank you in advance.
DOCX is a zip - format file so you can process the contents programmatically and the reconstruct the zip file. PPT is a binary format though newer versions of PowerPoint might also construct zip-oriented versions that you can programmatically process. You mentioned though that you need don't want to programmatically process these documents - which I would probably also do only as a last resort.
For your DOCX origin/source documents (or doc,odt,rtf but not ppt/pdf) you could use Docmosis cloud services if your app can have the external dependency. You would upload your DOCX origin documents with placeholders for text-fields or images as a one-off/occasional task. Your iOS app then calls Docmosis sending instructions and data to create the output PDF and either stream it back to the app or email/store it or both.
The upside is it takes all the load and coding away from the iOS application (there is an SDK). The downside is it is an external depdendency. Please note I work for the company the created Docmosis.
Hope that helps.
Why not just load a page in a webView modal that points to a URL of a page you create? The main parts of the page would be static, and then the fields you need to customize would be populated via Javascript or PHP.
For example, we have a contact form in our app that gives you an option to view the details of your completed form after you submit. When the user clicks on the button to view the Contact Confirmation, it loads example.com/confirmation.php in a modal view within the iOS App.
On the confirmation.php page (on the web), I use PHP to pull in $_GET variables from the URL parameters which then populates the page with my static content, and their customized information that they entered into the form.

Resources