httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lauralyn Ninow <Lauralyn.Ni...@comtrol.com>
Subject RE: [users@httpd] RE: IE6+Adobe Reader 5 will not open a PDF File
Date Tue, 08 Apr 2003 20:47:16 GMT
I don't know what to say, other than I don't think POST/GET matters. As long
as you are writting your headers and data correctly.  Look at the specs for
HTTP and get a sniffer to see the data (the contents of the PDF file) you
are sending.  You may be sending wrong data or something.  A PDF file should
start with %PDF-1.4% and end with a %%EOF

The only way I could write the data is by writing the file out in binary
chunks to the browser. The speed is what you'd expect for large files, so
for your CGI program to do this really wouldn't be a big deal.

What are you trying to accomplish?  are you wanting the person to download
the PDF file? or do you wnat the PDF file to open in the person's browser?
You can't really control this unless you pass an uncommon mime-type. Most
browsers will prompt to download an unknown mime-type. But for PDF files,
you can bet that people have that configured to open in their browsers.

LN
> -----Original Message-----
> From: Andrus [mailto:eetasoft@online.ee]
> Sent: Tuesday, April 08, 2003 1:27 PM
> To: users@httpd.apache.org
> Subject: [users@httpd] RE: IE6+Adobe Reader 5 will not open a PDF File
> 
> 
> I added the
> 
> Transfer-Encoding: binary
> Connection: Close
> 
> headers, but the problem persists.
> 
> Do you return 73 MB PDF files !? My PDF files are small.
> 
> I think that this problem occurs if two conditions are met:
> 
> (1) Browser uses POST request to require a PDF file from CGI 
> app in Apache
> Web server
> 
> and
> 
> (2) CGI app returns a reference to this file (using Location: 
> or Status: 302
> Moved  headers)
> 
> Then result pdf file is not displayed in browser.
> 
> 
> Removing condition (1) means to change POST to GET. This 
> means major update
> of my web application.
> 
> Removing condition (2) means to return a PDF file directly from CGI by
> dumping it to stdout. I'm afraid that
> this makes my CGI application slow. Problably returning a 
> reference to PDF
> file to Apache is faster. Also, my CGI connector uses 
> printf() to return
> data. This returns corrupted pdf files since 0x00 butes are 
> not returned.
> I don't have windows C compiler installed which is required 
> to change this
> small C code.
> 
> Any idea ?
> 
> > From: Lauralyn Ninow <Lauralyn.Ninow@comtrol.com>
> 
> >hmm.  I'll just tell you what I did.
> 
> >I didn't user the Location header. I had problems with HUGE 
> ( upto 73 Meg)
> files that I needed to send to the customer, so I did it by 
> writing binary
> chunks. ASP snippet:
> 
> >Response.ContentType = objF.ContentType(objF.FileExtension)
> >'this is my lookup for the proper ContentType
> >Response.AddHeader "Content-Disposition", "filename=" &
> >objF.ShortName
> >response.AddHeader "Transfer-Encoding", "binary"
> >'added
> >response.addheader "Connection", "Close" 'added
> >Response.AddHeader "Content-Length", fsize
> 
> >objF.Chunksize = ChunkSize
> >For lngBytesRead = 0 To fsize Step ChunkSize
> >If lngBytesRead + ChunkSize > fsize Then
> >Exit For
> >end if
> >' objF.SeekRelative lngBytesRead  'start where we left
> >off.
> >response.binarywrite objF.ReadBytes()
> >Next
> >'perform last read
> >If lngBytesRead + ChunkSize > fsize Then
> >objF.ChunkSize = (fsize - lngBytesRead)
> >' objF.SeekRelative lngBytesRead  'start where we left
> >off.
> >response.binarywrite objF.ReadBytes()
> >End If
> >Response.Flush
> >objF.CloseFile
> 
> > From: Andres [mailto:eetasoft@online.ee]
> >
> > Lauralyn, thank you for assistanse.
> >
> > According to this, I make two attemps (two returning two
> > different set of
> > headers from CGI) to return pdf file to IE 6 from a CGI app,
> > but without
> > success.
> > Empty browser window appears. PDF is not displayed.
> >
> > ATTEMPT 1
> >
> > Content-type: application/pdf
> > Content-Disposition: inline,filename=_0x9123445.pdf
> > Location: /eeva/_0x9123445.pdf
> >
> > Result access log:
> >
> > 127.0.0.1 - - [06/Apr/2003:21:14:16 +0300] "POST
> > /eeva/eva.exe/PrintRun.pdf?Type=P&SubType=P&Id=&Form=LAOSEIS
> > HTTP/1.1" 200
> > 5555
> >
> > ATTEMPT 2
> >
> > Status: 302 Moved
> > Content-Disposition: inline,filename=_0x919czwm.pdf
> > Location: /eeva/_0x919czwm.pdf
> >
> > Result access log:
> >
> > 127.0.0.1 - - [06/Apr/2003:21:09:48 +0300] "POST
> > /eeva/eva.exe/PrintRun.pdf?Type=P&SubType=P&Id=&Form=LAOSEIS
> > HTTP/1.1" 302 0
> > 127.0.0.1 - - [06/Apr/2003:21:09:52 +0300] "GET /eeva/_0x919czwm.pdf
> > HTTP/1.1" 200 5555
> >
> > Additional info:
> >
> > 1. Some PDF files are displayed and some not. It seems that
> > this is related
> > to
> >  PDF file contents-CGI-Apache combination.
> > If i use other web server which servers the same pdf files
> > without CGI, all
> > pdf files are displayed in IE 6 !
> >
> > 2. After pressing Refresh button and answering Retry, my CGI
> > app receives a
> > GET request instead of original POST request.
> >
> >
> > Any help ?
> >
> > >From: Lauralyn Ninow <Lauralyn.Ninow@comtrol.com>
> > >you have to provide the filename in the header for it to 
> work in IE.
> >
> > >(sorry, this is asp code:)
> > >Response.AddHeader "Content-Disposition", "filename=" &
> > objF.ShortName
> 
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP 
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

Mime
View raw message