tabs problem during docx2pdf conversion
Posted: Thu Nov 29, 2012 1:52 am
I'm trying to convert a WordprocessingMLPackage instance to pdf format. This is the code I am using:
Basically the conversion works. But there are two problems I face:
1. the tabulator within the pdf file do not conform with the tabulator set in the corresponding MS word file
2. during conversion I get the following error:
Are these two issues somehow linked ?
Any ideas how to solve these issues?
I attached the report.docx (source) and the report.pdf (target) files.
Thank you for your help in advance!
- Code: Select all
WordprocessingMLPackage document = WordprocessingMLPackage.load(new FileInputStream(new File("c:/report.docx")));
Mapper fontMapper = new IdentityPlusMapper();
document.setFontMapper(fontMapper);
File fo = new File("c:/report.fo");
File pdf = new File("c:/report.pdf");
org.docx4j.convert.out.pdf.PdfConversion converter = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(document);
((org.docx4j.convert.out.pdf.viaXSLFO.Conversion)converter).setSaveFO(fo);
os = new FileOutputStream(pdf);
converter.output(os, new PdfSettings());
Basically the conversion works. But there are two problems I face:
1. the tabulator within the pdf file do not conform with the tabulator set in the corresponding MS word file
2. during conversion I get the following error:
- Code: Select all
*ERROR* NamespacePrefixMapperUtils: name: com.sun.xml.internal.bind.namespacePrefixMapper value: org.docx4j.jaxb.NamespacePrefixMapperSunInternal@2f80b005 .. trying RI. (NamespacePrefixMapperUtils.java, line 63)
Are these two issues somehow linked ?
Any ideas how to solve these issues?
I attached the report.docx (source) and the report.pdf (target) files.
Thank you for your help in advance!