• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Save and upload a PDF via javascript bookmarklet

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
greatseats
Asked:
greatseats
  • 3
  • 2
1 Solution
 
Michel PlungjanIT ExpertCommented:
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
 
greatseatsAuthor Commented:
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
 
Michel PlungjanIT ExpertCommented:
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
 
greatseatsAuthor Commented:
Mplungjan,

Thanks for that link - it is very helpful.  I think that this will work for me.
0
 
Michel PlungjanIT ExpertCommented:
You are welcome. HTA is very useful in controlled environments.
I use it often to scrape webpages for example
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now