Improve company productivity with a Business Account.Sign Up

x
?
Solved

Save and upload a PDF via javascript bookmarklet

Posted on 2010-09-02
5
Medium Priority
?
513 Views
Last Modified: 2013-11-11
Hello all,

There is a system we work with that generates reports as PDF files in the browser.  These PDF files are only able to be opened in the browser which generated the file.  Every time someone in my company generates one of these reports they must save the report to their computer, visit our website, and upload the file.  This is a time consuming process.

I have been tasked with finding a way to automate this.  My idea is to have a javascript bookmarklet that would post the location of the PDF file in the browser's cache to an upload script running on our website.  ie, when one of our employees generates a report they would click the bookmarklet.  A new tab would open on our website with the location of the PDF in the browser cache as part of the URL querystring.  Javascript on ths page would automatically start the upload.  I am not that well versed in javascript.  Is this possible?  I already have the upload script written and working.

Thanks in advance!
0
Comment
Question by:greatseats
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33596061
It is not possible to do with javascript alone since you would need to populate a file upload field with the file.

This is for obvious security reasons not possible.

I suggest you look into creating a plugin or a stand alone app for example using HTA if you can rely on IE being present.
Adobe Air is another alternative I believe
0
 

Author Comment

by:greatseats
ID: 33597804
Mplungjan,

Thanks for the info.  Since this script would only be running in a controlled environment I would know ahead of time the file structure of each computer.  Is it possible to use javascript to save the current file (ie, a PDF file) to a specific location?
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 33597887
Only if you use HTA, WSH and the file system object

But then you do have full access to do what you want since the user started the app from the filesystem too

http://technet.microsoft.com/en-us/library/ee692768.aspx
0
 

Author Comment

by:greatseats
ID: 33598217
Mplungjan,

Thanks for that link - it is very helpful.  I think that this will work for me.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33598573
You are welcome. HTA is very useful in controlled environments.
I use it often to scrape webpages for example
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

585 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question