🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.acrobat.reader
Article #11630

PDF in Content-Type multipart/mixed

#11630
From: Ralf Steppacher
Date: Wed, 26 Jun 2002 13:39
44 lines
2708 bytes
Hello everybody. 

I have a problem displaying a pdf document that is served through the response object of a jsp as the second part of a multipart/mixed message. The pdf is generated on the fly on the serverside so I display a "Please be patient" HTML page as the first part of the multipart message. This page should be replaced by the pdf as soon as the generation process finishes. When the pdf is sent to the browser the splash screen of the reader plugin shows up but I end up with a blank browser window.  
If I change the Content-Type of the message part serving the pdf to text/plain I get the pdf data. 
If I do not create a multipart message but directly set Content-Type to application/pdf and send the document right away everything works fine, too. 

Does anybody know if this is an issue of the Acrobat Reader Plugin? 

Code 
--------------------- 
String boundary = "outerBoundary"; 

response.setContentType( "multipart/mixed;boundary=" + boundary ); 
ServletOutputStream outStream = response.getOutputStream(); 
outStream.print( "MIME-Version 1.0\n" ); 
outStream.print( "\n" ); 
outStream.print( "--" + boundary + "\n" ); 
outStream.print( "Content-Type: text/html\n" ); 
outStream.print( "Content-Transfer-Encoding: chunked\n" ); 
outStream.print( "\n" ); 
outStream.println( "" ); 
outStream.println( "" ); 
outStream.println( "" ); 
outStream.println( "

Bitte gedulden Sie sich einen Moment..." ); 
outStream.println( "" ); 
outStream.print( "\n" ); 
outStream.print( "--" + boundary + "\n" ); 
outStream.flush(); 

// generate pdf document into a byte array 'result' 

outStream.print( "Content-Type: application/pdf\n" ); 
outStream.print( "Content-Transfer-Encoding: chunk\n" ); 
outStream.print( "\n" ); 
outStream.write( result ); 
outStream.print( "\n" ); 
outStream.print( "--" + boundary + "--\n" ); 
outStream.flush(); 
-------------------- 

TIA! 
Ralf Steppacher
Technical Details
Message-ID: <ef95652.-1@WebX.aaQKaf7vad4>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!ps01-sjc1!news.webusenet.com!newsfeed1.cidera.com!Cidera!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109513,9729e3420e635541,start
X-Google-Attributes: gid109513,public
X-Google-ArrivalTime: 2002-06-26 07:08:37 PST
From: "Ralf Steppacher" <ralf@steppacher.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!ps01-sjc1!news.webusenet.com!newsfeed1.cidera.com!Cidera!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.acrobat.reader
Subject: PDF in Content-Type multipart/mixed
Message-ID: <ef95652.-1@WebX.aaQKaf7vad4>
Date: Wed, 26 Jun 2002 06:39:39 -0700
Lines: 51
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit