Page 1 of 1

Template with pdf form

PostPosted:Mon Mar 12, 2012 1:30 pm
by ahmed
i am build simple form using OpenOffice form deign with arabic values in fields, i notice that when i export the pdf with default option the Arabic values not visible in fields, but when i export the document using the PDF/A-1 (ISO 19005-1:2005) the values appears. so i want to know where the openkm call the OpenOffice API to change the value of "SelectPdfVersion=0" to be "SelectPdfVersion=1".
that means when i use templates associate with PropertyGroups i can enter Arabic data in fields and it will be generation also in pdf .
the current setting in openkm work with English values only in templates with PropertyGroups

Re: Template with pdf form

PostPosted:Tue Mar 13, 2012 6:43 pm
by pavila
If you start OpenOffice with the same user that starts JBoss / OpenKM, the OpenOffice configuration should be the same because it stored this configuration in the user home. Have you tried this?

Re: Template with pdf form

PostPosted:Sun Mar 18, 2012 11:51 am
by ahmed
hi all, after a lot of search in Google i figure out that the problem is from PDFStamber library that openKM used, it's not support Arabic characters. i working on solution may be solve the problem and wish to me luck :D

Re: Template with pdf form

PostPosted:Mon Mar 19, 2012 12:58 pm
by ahmed
after a lot of goggling i found the answer:
to write Unicode characters to pdf using PDFStamper you must do the following:-
1-download the times.ttf font from any site
2- add the font in your project resource
3- add the font to acrofields using setProprieties function like following:

//u must set the input stream with your file
InputStream input;
OutputStream output;

PdfReader reader = new PdfReader(input);
PdfStamper stamper = new PdfStamper(reader, output);
AcroFields fields = stamper.getAcroFields();
PRAcroForm form = reader.getAcroForm();
BaseFont bf = BaseFont.createFont("/com/openkm/util/times.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

fields.setFieldProperty("myfieldName","textfont",bf, null);
fields.setField("myfieldName", "احمد حمزة ، وهذا اختبار جديد");
stamper.partialFormFlattening("myfieldName");

stamper.setFormFlattening(true);
stamper.close();
reader.close();

Re: Template with pdf form

PostPosted:Tue Mar 20, 2012 10:28 am
by pavila
Time.ttf has Arabic characters?

Re: Template with pdf form

PostPosted:Mon Mar 26, 2012 12:55 pm
by ahmed
Yes Time.ttf has Arabic characters, and it work with me.