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

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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 19:17:05 GMT