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

Creating a PDF file with UTF-8 encoding through Servlet

From: souravm <SOURAVM@infosys.com>
Date: Fri, 20 May 2005 18:43:23 +0530
Message-ID: <56E2573C375A414191118970BDE06A1511172FBE@kecmsg06.ad.infosys.com>
To: <www-international@w3.org>

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

Received on Friday, 20 May 2005 13:15:02 UTC

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