Lua script in Splash - direct file download by button click - lua

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.

Related

new google site - How to upload a pdf

I would like to upload the pdf of a paper on my new google site. Specifically, I want that people can click on, say, "paper_title" and can visualize the pdf and, if they want, download it.
I would like if possible a step-by-step explanation.
Thanks!
This is fairly straightforwards:
Firstly, store the PDF files on Google Drive and, set the link sharing as appropriate (e.g. anyone with link can view) so even anonymous internet users can see the file.
To make the PDF available via Google Sites you can either:
From Drive, copy the link to the file, and in new Sites insert a text box and
include the hyperlink to the PDF file in the text box.
in new Sites Insert (From Drive) and select the PDF file from the Google Drive; gives the same result as above, but with a re-sizable thumbnail picture of the PDF file instead of a link.
Exactly what happens after they click on the link is going to depend upon what browser the user is using, and what (if any) PDF viewer plugin is installed. Chrome, pretty much does what you want: it opens the PDF file in a viewer, from where you can download it.
Even if you don't store the PDF on Google Drive, what is described above should still work, as long as you have a hyperlink to the PDF file.

Spyder Ipython Console - code to automatically print to pdf and save to HTML file

I am working in Spyder and would like to record the console output as either a html or pdf file. Currently the only way to achieve this is to right click on the console window and then choose 'save as'.
The problem with this approach is that the file path needs to be specified manually. It would be much more desirable to be able to set the working directory in the code and then save the pdf or html automatically to this location. Is this possible?
Or if this is not possible, is there any code that when the 'save as' option is right clicked, the file browser is opened on the current working directory?
(Spyder developer here) My answer:
Or if this is not possible, is there any code that when the 'save as' option is right clicked, the file browser is opened on the current working directory?
We can implement this in a future release. Please open an issue in our issues tracker so we don't forget to do it in the future.

Edge extension - how to create downloadable content?

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?

Open a link in web browser using flash swf

I am new to flash coding and didn't know much more.
I want to make a flash file that send URL to web browser to open particular link.
I've made such file it execute properly but after making swf file, it does not open the link.
Any one help me regarding this small problem.
Check out navigateToURL(): http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL()
Note that it won't work unless it's triggered by a user action; i.e. a mouse click or a key press

Zope external editor with upload-on-save (Notepad++ prefered)

We are doing webdevelopment with Zope.
The web-editor is just horrible. No syntax highlighting, no in-text-tabs, nothing you can work with.
I installed Zope External Editor. It is now possible that I click the "use external editor" button on every element and it creates a temporary file and opens it in Notepad++, awesome.
But one important thing fail: it doesn't save back to Zope when I save the file. I still have to copy the code back to Zope manually.
I also searched for syntax highlighting extension for chrome/firefox at least to highlight the code (but I prefer Notepad++ with upload-on-save).
Can someone help me with that?
Did you also download the ExternalEditor Helper application?
Your browser should open the helper application, which will then open the editor (which you can specify in the configuration, see last point below). This is important because the helper application is responsible for sending changes back to Zope, which it does by keeping an open WebDAV session while you are editing.
You should download the latest helper app here: http://plone.org/products/zope-externaleditor-client
From that page:
Under Windows: Install the windows binary executable.
Open your page in your web browser and click on the link 'edit with external application'
Associate the file with Zope External Editor and make it permanent (first time only)
The file is opened in the editor defined in windows registry with certain editors, a message will ask whether the edition is terminated or not;
keep it until you closed you file and say yes.
If you want to change your default editor for certain content types , or if you want to add proxy parameters, open Zope External Edit in your program files menu and change your local user configuration.
The best option is to not develop Zope applications through-the-web anymore.
Use proper python packages, and you'll get to use your favourite tools without difficult integration with the server.

Resources