W3C home > Mailing lists > Public > www-international@w3.org > April to June 2005

Re: Creating a PDF file with UTF-8 encoding through Servlet

From: Felix Sasaki <fsasaki@w3.org>
Date: Tue, 24 May 2005 20:13:51 +0900
Message-ID: <42930C6F.10807@w3.org>
To: souravm <SOURAVM@infosys.com>
Cc: www-international@w3.org, kurt@pdflib.com

souravm wrote:

>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. 

I mailed Kurt Stuezer about this. He is working on pdflib. His answer is 

-- Felix Sasaki
Received on Tuesday, 24 May 2005 11:13:55 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 21 September 2016 22:37:25 UTC