Copy a PDF file (not contents) to clipboard

L

lunchroom

Using VS2008/C#/ASP.NET 3.5
I have a webform that displays a list of document references pulled
from a database in a Gridview. The data records point to a reference
path in the windows file system where the actual PDF exists. The user
can select checkboxes and press a button to have those documents
emailed to someone else entirely from the web page. This is done
iterating through the selected rows and then attaching the docs to a
System.Net.Mail.MailMessage object and sending through SmtpClient.
This works great, except some users would like to be able to select a
document from the list and press a button to "copy" that PDF (not the
contents, but the actual PDF file) to the clipboard. Ideally, they
could reply to an existing message in their Inbox and just "paste" the
PDF file into that message without having to always originate a new
message from my web page.

Any suggestions? I'm afraid it's not going to be possible in
ASP.NET. Can someone please confirm? If so, any reasonable
alternatives? I thought maybe if they were able to click on a button
and open a Windows Explorer window to the folder where the file
resides and then select/highlight the file they're interested in
automatically. That way, they could just click that button and then
hit Ctrl-C to copy the file they want.

Thoughts?

Thanks,
lunchy
 
R

Rich P

I am pretty sure it is not possible to copy a file as you describe. But
why not use some ajax and make a file downloadable on mouse right-click?
Have a context menu wiht a download option.

Rich
 
L

lunchroom

Thanks for the reply, Rich. They currently have that option built
into the browser with right-mouse click and Save Target As... (we're
exclusive IE inhouse). They don't want to have to take that extra
step of saving to their desktop and then dragging/attaching to their
email. It's a minor nuisance I know, but thought I'd see if there's a
way to either copy to clipboard or maybe drag and drop from the web
page to an existing email.

Any other thoughts?
 
J

Jeff Johnson

This works great, except some users would like to be able to select a
document from the list and press a button to "copy" that PDF (not the
contents, but the actual PDF file) to the clipboard.

So, exactly what do you consider to be the difference between "the PDF file"
and the "contents" of the PDF file? As far as I'm concerned, a file IS its
contents. Everything else is just metadata about those contents.
 
L

lunchroom

So, exactly what do you consider to be the difference between "the PDF file"
and the "contents" of the PDF file? As far as I'm concerned, a file IS its
contents. Everything else is just metadata about those contents.

Jeff,
If you right-click on a PDF and select COPY, you can then right-click
on the desktop and select PASTE and the PDF will be pasted to the
desktop. In this case, you have the actual PDF copied to the clipboard
- this is what I refer to as "the PDF file". Alternatively, If you
open a PDF and highlight all the text from its contents and select
COPY, you can't right-click on the desktop and select PASTE because
you can't PASTE all the text directly to the desktop - this is what I
refer to as the "contents".

lunchroom
 
J

Jeff Johnson

If you right-click on a PDF and select COPY, you can then right-click
on the desktop and select PASTE and the PDF will be pasted to the
desktop. In this case, you have the actual PDF copied to the clipboard
- this is what I refer to as "the PDF file". Alternatively, If you
open a PDF and highlight all the text from its contents and select
COPY, you can't right-click on the desktop and select PASTE because
you can't PASTE all the text directly to the desktop - this is what I
refer to as the "contents".

When you right-click on a file in Explorer and choose Copy you put a special
type of information on the clipboard that is basically a PATH to the file. I
suppose you could call it a "reference" as well. But it is NOT "the file."
So your definition of "file" applies ONLY to the clipboard. You could not
put this "file" on a floppy disk or USB drive or send it over the network.
You can only do that with the "contents" of the file, and that's what
99.9999999% of people think of as "the file."
 
J

Jeff Johnson

When you right-click on a file in Explorer and choose Copy you put a
special type of information on the clipboard that is basically a PATH to
the file. I suppose you could call it a "reference" as well. But it is NOT
"the file." So your definition of "file" applies ONLY to the clipboard.
You could not put this "file" on a floppy disk or USB drive or send it
over the network. You can only do that with the "contents" of the file,
and that's what 99.9999999% of people think of as "the file."

Let me clarify this with an example.

1) Create a dummy text file on your machine somewhere or make a copy of a
small file.

2) Right-click it and choose Copy.

3) Delete the file.

4) Right-click and choose Paste.

If the actual file were copied to the clipboard, you'd still be able to
paste it. Instead you get an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top