Solved

Save and upload a PDF via javascript bookmarklet

Posted on 2010-09-02
5
487 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
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
You are welcome. HTA is very useful in controlled environments.
I use it often to scrape webpages for example
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now