Instead of

response.setContentType("application/pdf");

 

try

response.setContentType("application/download");




Best Regards,
Khurram Ilyas
 



>From: "Addison Phillips" <addison.phillips@quest.com>
>To: "souravm" <SOURAVM@infosys.com>,<www-international@w3.org>
>Subject: RE: Creating a PDF file with UTF-8 encoding through Servlet
>Date: Fri, 20 May 2005 09:14:10 -0700
>
>
>PDF files are binary, not text, objects.
>
>Addison
>
>Addison P. Phillips
>Globalization Architect, Quest Software
>Chair, W3C Internationalization Core Working Group
>
>Internationalization is not a feature.
>It is an architecture.
>
> > -----Original Message-----
> > From: www-international-request@w3.org [mailto:www-international-
> > request@w3.org] On Behalf Of souravm
> > Sent: 2005?5?20? 6:13
> > To: www-international@w3.org
> > Subject: Creating a PDF file with UTF-8 encoding through Servlet
> >
> >
> > Hi All,
> >
> > I need to create and return back a PDF file from Servlet as a response to
> > http request (typical download functionality).
> >
> > Now for this purpose I'm -
> >
> > 1. First setting following fields in response onject -
> > response.setContentType("application/pdf");
> > response.setHeader("Pragma", "");
> > response.setHeader("Cache-Control", "");
> > response.setDateHeader("Expires", 0);
> >
> > 2. After that I'm creating an OutputStream object from the response object.
> >
> > 3. Using theat OutputStream object I'm wrting the content of the PDF file
> > (using APIs of PDFlib). Using PDFDocument.open(OutputStream) to create the
> > document object.
> >
> > 4. After writing the content of the PDF I'm closing the PDF file
> > (PDFDocument.close()).
> >
> > In this context, I'll like to know, don't I need to specify the encoding
> > of the PDF document through the setContentType API ? Say, I'm creating a
> > PDF file with Japanese content and I want the encoding of the file to be
> > of Shift_JIS.
> >
> > Any pointer/information on thios would be highly appreciated.
> >
> > Regards,
> > Sourav
> >
> >
>
>
>