954,591 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Linking to PDF documents from HTML

I am trying to link a PDF document in HTML and I keep getting this error:

"Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

My code is a simple link to a PDF document, however I think it needs to launch their PDF reader. How do I do that?

aslittell
Newbie Poster
10 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

show the link code

You dont launch their reader,
they either have the reader set up to handle urls to pdf files or they will get the download prompt

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

Ok, however when I just tried to open the link on my website it went to some cryptic code and didn't launch my adobe reader. It's almost as though the browser was trying to translate the PDF file.

aslittell
Newbie Poster
10 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

thats why the first line is
"show the link code"

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

oh.. sorry I am really new to this whole thing and I've only done basic HTML websites.

<a href="Files/5GraphicDesignEssentials.pdf" target="_blank"><img src="Files/5GraphicDesignEssentials.jpg" style="position: absolute; left: 257px; top: 418px;" height="304px" width="254px"></a>
aslittell
Newbie Poster
10 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

remove the target attribute and see if the pdf opens properly in the same page
seems dumb but pdf is a proprietary format and not all implementations in browsers work always

is this an html or xhtml page, if xhtml the image tag isnt closed

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

It is html, and removing the target didn't help at all. It is still trying to convert the PDF to something readable in browser. It doesn't matter what browser I am using does it? I am using Firefox.

Here is the beginning part of what I'm seeing after clicking on the link:

%PDF-1.4
%âãÏÓ
1 0 obj<</Metadata 282 0 R/Pages 2 0 R/Type/Catalog>>
endobj
2 0 obj<</Count 1/Type/Pages/Kids[5 0 R]>>
endobj
5 0 obj<</Parent 2 0 R/Contents 268 0 R/BleedBox[0.0 0.0 612.0 792.0]/ArtBox[14.5874 5.31738 570.832 716.0]/Group 269 0 R/MediaBox[0.0 0.0 612.0 792.0]/Thumb 281 0 R/TrimBox[0.0 0.0 612.0 792.0]/Resources<</XObject<</Im0 13 0 R/Im1 17 0 R/Im2 21 0 R/Im3 25 0 R/Im4 13 0 R/Im5 17 0 R/Im6 21 0 R/Im7 25 0 R>>/ColorSpace<</CS0 197 0 R>>/Font<</TT0 140 0 R/C2_0 147 0 R/C2_1 154 0 R>>/ProcSet[/PDF/Text/ImageC]/Properties<</MC0<</Color[20224.0 32768.0 32768.0]/Visible true/Editable false/Dimmed false/Preview true/Printed true/Title(Design)>>/MC1<</Color[20224.0 32768.0 32768.0]/Visible true/Editable true/Dimmed false/Preview true/Printed true/Title(Page 1)>>/MC2<</Color[20224.0 32768.0 20224.0]/Visible false/Editable true/Dimmed false/Preview true/Printed true/Title(Page 2)>>/MC3<</Contents 159 0 R/Resources<</XObject<</Im0 76 0 R/Im1 78 0 R/Im2 82 0 R/Im3 84 0 R/Im4 88 0 R/Im5 90 0 R/Im6 92 0 R/Im7 96 0 R/Im8 98 0 R/Im9 100 0 R>>/ColorSpace<</CS0 247 0 R/CS1 248 0 R/CS2 249 0 R/CS3 250 0 R>>/Font<</TT0 140 0 R/TT1 152 0 R/C2_0 142 0 R/C2_1 147 0 R/C2_2 154 0 R>>/ProcSet[/PDF/Text/ImageC/ImageI]/ExtGState<</GS0 251 0 R>>>>/AIType/HiddenLayer>>/MC4<</Color[20224.0 20224.0 32768.0]/Visible false/Editable true/Dimmed false/Preview true/Printed true/Title(Page 3)>>/MC5<</Contents 228 0 R/Resources<</XObject<</Im0 204 0 R/Im1 206 0 R/Im2 210 0 R/Im3 212 0 R/Im4 216 0 R/Im5 218 0 R/Im6 222 0 R/Im7 224 0 R/Fm0 187 0 R/Fm1 200 0 R>>/Shading<</Sh0 177 0 R/Sh1 188 0 R/Sh2 189 0 R/Sh3 190 0 R/Sh4 191 0 R>>/ColorSpace<</CS0 197 0 R/CS1 252 0 R/CS2 253 0 R/CS3 254 0 R/CS4 255 0 R/CS5 225 0 R/CS6 198 0 R>>/Font<</TT0 140 0 R/C2_0 142 0 R/C2_1 147 0 R/C2_2 154 0 R>>/ProcSet[/PDF/Text/ImageC/ImageI]/ExtGState<</GS0 256 0 R/GS1 257 0 R/GS2 258 0 R>>>>/AIType/HiddenLayer>>/MC6<</Color[32768.0 32768.0 20224.0]/Visible false/Editable true/Dimmed false/Preview true/Printed true/Title(Page 4)>>/MC7<</Contents 246 0 R/Resources<</XObject<</Im0 238 0 R>>/ColorSpace<</CS0 197 0 R>>/Font<</TT0 140 0 R/C2_0 142 0 R/C2_1 147 0 R/C2_2 154 0 R>>/ProcSet[/PDF/Text/ImageC]/ExtGState<</GS0 259 0 R>>>>/AIType/HiddenLayer>>>>/ExtGState<</GS0 6 0 R/GS1 260 0 R>>>>/Type/Page>>
endobj
6 0 obj<</OPM 1/BM/Normal/CA 1.0/OP false/SMask/None/ca 1.0/AIS false/op false/Type/ExtGState/SA true>>
aslittell
Newbie Poster
10 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

Bingo

pdf is a proprietary format,
and there is a known problem with firefox, there is a solution,
http://support.mozilla.com/en-US/kb/Opening+PDF+files+within+Firefox
you can put the target back

>87% of potential users(those not using firefox + those who have patched firefox) will see the pdf as intended

**edit** If i were alert, that would have been the first question
IE bugs make news
FF bugs make fixes

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

Thank you so much for your help!

aslittell
Newbie Poster
10 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You