Hi Paolo,

Can I gather from your response that there is nothing inherently wrong with the code I posted and that iText is capable of setting CJK text as form fields?

How would I go about finding if the form field in a form document supports CJK text. Do I open the PDF file in a text/hex editor and look for a specific pattern?

Thanks fro your help.

Geoff

Paulo Soares wrote:

Without looking at the pdf your guess is as good as mine.



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Geoff Waggott
Sent: Friday, April 22, 2005 2:50 AM
To: [email protected]
Subject: [iText-questions] Using CJK text as form field values


Hi everyone,

I'm new to iText and PDF generation, so if I'm asking something blatantly obvious or stupid please forgive me.

I have a web application where I'm generating PDF documents for download based on a template document containing a form. A code snippet of how I'm doing this included below. This works fine if the values I'm placing in the fields is English, but if I try to place Japanese text in them it doesn't show up in resulting document. The source document has other Japanese text in it which displays fine.

Is this an issue with how I'm using iText or is it an issue with the source document? I created the source form using Scribus on Linux. I notice that you can specify a language on the text fields using Scribus, but Japanese is not available in the options provided. Could that be the problem?

Thanks in advance for any help you can give.

Geoff

PdfReader reader = new PdfReader(templatesPath + "/contract.pdf");
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfStamper stamp = new PdfStamper(reader, buffer);
AcroFields form = stamp.getAcroFields();
//set the field values in the pdf form
form.setField("applicationNumber", contract.getApplicationNumber());
form.setField("name", contract.getName());
form.setField("nameKana", contract.getNameKana());
form.setField("address", contract.getAddress());
form.setField("phone1", contract.getPhoneNumber());
form.setField("phone2", contract.getPhoneNumber2());
form.setField("email", user.getUsername() + "@" + user.getDomain());
form.setField("password", user.getPassword());
stamp.setFormFlattening(true);
stamp.close();
comms.response.setContentType("application/pdf");
comms.response.setHeader("Content-Disposition", "attachment;filename=contract.pdf");
comms.response.setContentLength(buffer.size());
buffer.writeTo(comms.response.getOutputStream());
comms.response.getOutputStream().flush();







------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to