Adobe Reader의 웹브라우저 플러그인은 PDF 파일 전체를 다운로드하지 않고 일부만 먼저 다운로드하여
보여주는 기능이 있다. 이것은 HTTP 1.1 규격의 Byterange Request를 이용하여 파일의 특정 영역만
다운로드할 수 있기 때문인데, Adobe Reader의 버전에 따라 혹은 웹서버의 버전에 따라 꼬이는 경우가 있다.
필자의 경우 Windows Vista x64에서 Firefox 2.0 및 Internet Explore 7.0 환경에 Adobe Reader 8.1를
설치하였는데, 몇몇 사이트에서는 PDF 파일이 잘 보이는 반면 다른 몇몇 사이트에서는 계속 백지로
나타나는 현상이 발생했다. Firefox의 확장 기능인 Live HTTP Header로 분석한 결과 PDF 파일이 나오지
않는 사이트에서는 206 Partial Content라는 response가 나타남을 알 수 있었고 이를 조사한 결과
위와 같은 결론을 얻게 된 것이다.
용량이 큰 PDF 파일을 서비스할 때는 전체 다운로드를 하여야 하므로 조금 불편할 수 있겠으나
아예 안 보이는 상황보다는 낫다고 판단, 다음과 같은 Apache 설정을 추가하였다.
- <FilesMatch "\.pdf$">
Header unset Accept-Ranges
RequestHeader unset Range
RequestHeader unset If-Range
RequestHeader unset Unless-Modified-Since
Header append Content-Disposition "filename: x.pdf"
</FilesMatch>
(위 코드는 mod_headers 모듈이 활성화되어 있어야 작동한다.)
이 문제는 lighttpd에서도 보고되어 있고 비슷한 방법으로 해결한다.
Acrobat in the Browser
If you've ever had the need to determine what version of the Acrobat Browser Plugin your web visitors are using then perhaps we can shed some light on how to find this information.
Using some simple JavaScript, it's possible to determine a whole range of version information from the PDF Viewing Component inside a Web Browser.
As the ActiveX Control (pdf.ocx) is undocumented and unsupported by Adobe Tech Support, programming with it can be wasted effort.
The other thing to note is that Internet Explorer and Netscape Navigator provide this information in two totally different ways -- surprise, surprise ;)
Internet Explorer
To find out the version of Acrobat being used inside Internet Explorer we need to create an Object
from the 'pdf.ocx' ActiveX control.
To accomplish this we need to know the Class ID of the Object we are to embed. Using Microsoft's ActiveX Control Pad you can easily do this (see references at the bottom of the page).
Alternatively you can look in the registry against the PDF.PdfCtrl.6 entry (CLSID).
The Class ID for the pdf.ocx for Acrobat 5/6 is:
CA8A9780-280D-11CF-A24D-444553540000
The ClassID for earlier versions may be the same, but as I no longer have these version installed I'm unable to find this out.
In a normal HTML page we add the following Tag:
<object id="Pdf1"
classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"
width="0"
height="0">
I generally put these right after the BODY tag so they are processed first as the browser parses the HTML.
<code>
<html>
<body>
<object id="Pdf1"
classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"
width="0" height="0">
</body>
</html>
</code>
Once the page is processed you will have a reference to the ActiveX Control (pdf.ocx) by using the object name 'Pdf1'.
By using some JavaScript we can get access to the Version information contained inside the object. The code section at the bottom of this article details the JavaScript I've used.
In brief we basically ask the 'Pdf1' object to give us a list of the version numbers (GetVersions()),
we can then do a quick check to see if this information has the numbers 6.0.0 or 5.0.0 (an also the updaters (5.0.5 and 6.0.1).
That code could be as simple as:
if(Pdf1.GetVersions().indexOf("6.0") != -1)
alert!!!("Acrobat 6 Found")
Netscape Navigator
As I mentioned before NN has a different approach when it comes to plugins.
There's an object in Netscape to provide access to plugins, it works like this:
var pluginName = navigator.plugins["Adobe Acrobat"].description;
if(pluginName.indexOf("6") != -1)
alert!!!("Acrobat 6 Found")
Because there's no ActiveX object to reference we can simply put this code (and obviously more)
into a function and call it from an onLoad or onClick event handler.
1. <embed src="FullScreenEmbed.pdf" width="500" height="375">
2. <embed src="FullScreenEmbed.pdf#toolbar=0&navpanes=0&scrollbar=0" width="500" height="375">
3. <embed src="FullScreenEmbed.pdf" width="500" height="375"/>