How to display a pdf file using code?

J

Jenny

Hi,

I want to use a button to display a pdf file. I have Windows 2000
server, IE 6 and Acrobat 7 with plug-in. I can use <a> link to display
it.

I search this group for js code but they don't work. I tried this
code:

<form><input type="button" value="View PDF" onclick="window.location =
'c:\Barcode1234.pdf';">
<input type="button" value="View"
onclick="window.open('c:\Barcode1234.pdf')">
</form>

The first button displays "The page cannot be displayed...".
The 2nd button displays new window displaying the drives on the PC,
such as A:, C: and D:.

Why does <a> works but not the code? Could you try the code and fix
it? May be I need to provide the file type but do not know the syntax.
Thanks a lot

Jenny
 
R

Richard

I want to use a button to display a pdf file. I have Windows 2000
server, IE 6 and Acrobat 7 with plug-in. I can use <a> link to display
it.
I search this group for js code but they don't work. I tried this
code:

I'm no expert with the coding, but I do not believe what you want to do is
possible.
As the "Adobe reader" has to be installed on the client's machine to work.
It may be possible though, to have it open up from the server, in which case
you'd need the reader installed on the server.
For that, I would suggest you contact your host for assistance.
 
M

Martin Honnen

Jenny wrote:

I want to use a button to display a pdf file.

Why can't you use a normal HTML link (and style that with CSS as a
button if needed)?
I search this group for js code but they don't work. I tried this
code:

<input type="button" value="View PDF" onclick="window.location =
'c:\Barcode1234.pdf';">

Use a proper file URL e.g.
<input type="button"
onclick="window.location = 'file:///C:/Barcode1234.pdf';"
...>
<input type="button" value="View"
onclick="window.open('c:\Barcode1234.pdf')">

Same here
onclick="window.open('file:///C:/Barcode1234.pdf');"
 
S

Stephen Chalmers

Jenny said:
Hi,

I want to use a button to display a pdf file. I have Windows 2000
server, IE 6 and Acrobat 7 with plug-in. I can use <a> link to display
it.

I search this group for js code but they don't work. I tried this
code:

<form><input type="button" value="View PDF" onclick="window.location =
'c:\Barcode1234.pdf';">
<input type="button" value="View"
onclick="window.open('c:\Barcode1234.pdf')">
</form>

A single backslash is interpreted as the start of an escape sequence.
Use a forward slash: 'c:/Barcode1234.pdf'
or escape the backslash: 'c:\\Barcode1234.pdf'
 

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

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top