karurkarthi / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

Special Characters problem when running on Linux #268

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Try to convert this attached file simply like this
      final IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Velocity);
      final IContext context = report.createContext();
      final OutputStream out = new FileOutputStream(new File(file + ".pdf"));
      final Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
      report.convert(context, options, out);

2. If you are running on Win OS all works OK
3. With all the same, change only the underling OS (using Linux) the special 
character à will be truncated

What is the expected output? What do you see instead?
The PDF converted on Linux OS misses the special chars, (à)

What version of the product are you using? On what operating system?
xdocreport version 1.0.2
OS: Ubuntu 13.04 64bit
Java: java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

Please provide any additional information below.

Original issue reported on code.google.com by pietroma...@gmail.com on 29 May 2013 at 2:00

Attachments:

GoogleCodeExporter commented 9 years ago
It seems that it's a problem with iText and installed font on your Linux OS.

I cannot help you more because I have not OS Linux.

Regards Angelo

Original comment by angelo.z...@gmail.com on 29 May 2013 at 2:08

GoogleCodeExporter commented 9 years ago
First of all thanks for quick reply.
I cheched the embedded fonts on PDF generated on Win and Ubuntu, the Arial Font 
(the one I use) is in both of them.
The only difference if on Font Encoding: on Win generated PDF it is "WinAnsi" 
while on Ubuntu generated one it is "Custom"
Is there any configuration I can Use to force to use WinAnsi encoding or it is 
out of control of xdocreport?

Aside Note: If I populate only the docx file, without converting into PDF all 
characters are displayed fine.

Thanks

Original comment by pietroma...@gmail.com on 31 May 2013 at 7:46

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

Have you tried to force the encoding with pdf options 
https://code.google.com/p/xdocreport/wiki/XWPFConverterPDFViaIText

Regards Angelo

Original comment by angelo.z...@gmail.com on 2 Jun 2013 at 2:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Yes! it works, now it converts with accent letter.
But how to generate a report not having the IXDocReport instance?

Thanks

Original comment by pietroma...@gmail.com on 4 Jun 2013 at 6:59

GoogleCodeExporter commented 9 years ago
I'm sorry, I don't understand what you mean with IXDocReport instance?

You wish just convert a docx to pdf? If it that please read 
https://code.google.com/p/xdocreport/wiki/XWPFConverterPDFViaIText

Original comment by angelo.z...@gmail.com on 4 Jun 2013 at 7:04

GoogleCodeExporter commented 9 years ago
I'll try to explain better.
I need to generate report from docx model (replace some merged fields) and then 
convert it to PDF.

Previously I used this code:
      final IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Velocity);
      final IContext context = report.createContext();
      final OutputStream out = new FileOutputStream(new File(file + ".pdf"));
      final Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
      report.convert(context, options, out);

And on IXDocReport instance "report" I can call "convert" method to have a PDF 
file.
With different version you suggested as 
https://code.google.com/p/xdocreport/wiki/XWPFConverterPDFViaIText
I don't know how to have the report functions, but only convert the file.

I hope I'm explained my needs

Original comment by pietroma...@gmail.com on 4 Jun 2013 at 7:36

GoogleCodeExporter commented 9 years ago
Ok I understand you wish to customize the font encoding for report#convert. The 
report#convert is based on 
https://code.google.com/p/xdocreport/wiki/XWPFConverterPDFViaIText

To customize pdf settings it, try that :

--------------------------------------------------
...
final Options options = 
Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF).subOptions(PdfOpti
ons.create().fontEncoding("windows-1250"));
report.convert(context, options, out);
--------------------------------------------------

Original comment by angelo.z...@gmail.com on 4 Jun 2013 at 7:45

GoogleCodeExporter commented 9 years ago
Yes! good product great support.
Thanks, you can close the issue

Original comment by pietroma...@gmail.com on 4 Jun 2013 at 7:56