I've no idea how Arabic should work in form fields. Send me a pdf filled in 
Acrobat for inspection. 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ayman Yasin
> Sent: Tuesday, February 15, 2005 7:49 AM
> To: [email protected]
> Subject: [iText-questions] Filling pdf form fields with arabic?
> 
> I am trying to fill a form field in an existing pdf file with 
> Arabic text from a java servlet using iText.
> 
> English works great but for Arabic the field shows garbage.
> 
> I tried to play with the text field properties using adobe 
> acrobat Middle Eastern edition. I changed the font to Arial 
> and the subset into Arabic.
> 
> Filling fields with Arabic from inside adobe acrobat works 
> but from the servlet it still shows garbage until I click on 
> the field for edit then it shows fine.
> 
> If I click away from the field it converts into garbage 
> again. If form flattening is set to true (which I want to do) 
> it shows unmodified garbage.
> 
>  Here is the code from the servlet doGet method:
> 
>  
> 
>  
> 
>       OutputStream out = response.getOutputStream();
> 
>       ByteArrayOutputStream baos = new ByteArrayOutputStream();
> 
>          try {
> 
>              PdfReader reader = new PdfReader("c:\\visa2.pdf");       
> 
>              PdfStamper stamp = new PdfStamper(reader, baos );
> 
>  
> 
>        
> 
>              AcroFields form = stamp.getAcroFields();
> 
>             
> 
>              form.setField("Text1", "أيمن" );  //Arabic text 
> in the second parameter
> 
>  
> 
>             //stamp.setFormFlattening(true);         
> //commented out to show the weird behavior with edit if not 
> commented shows unmodified garbage
> 
>              stamp.close();
> 
>             response.setContentLength(baos.size());
> 
>              baos.writeTo( out );
> 
>              baos.flush();
> 
>              baos.close();
> 
>              out.flush();
> 
>              out.close();
> 
> }
> 
>       catch(Exception e){System.out.println(e.getMessage());} 
>                       
> 
> 


-------------------------------------------------------
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_ide95&alloc_id396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to