Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Save and upload a PDF via javascript bookmarklet

Posted on 2010-09-02
5
Medium Priority
?
502 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…
Suggested Courses

971 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