Page 1 of 1

wordxml to pdf conversion issue with docx4j.jar

PostPosted: Thu Jun 22, 2017 12:13 am
by vinod.gvkr
“docx4j.jar” to convert “Word XML document” to PDF. while converting the xml file to PDF the alphabetical numbering goes wrong. It works fine if the user use any other numbering format (roman, Arabic). Moreover, If the document is saved as “Word 2003 XML document” instead of “Word XML document” then alphabetical numbering is fine but alignment goes wrong (Screen shots are included for reference).

We are using version docx4j-2.8.0 and I tried using the latest version - docx4j-3.3.1, but got the same result. Also, I tried debugging the source code but couldn’t find anything specific. We need your inputs on how to address this issue.

Re: wordxml to pdf conversion issue with docx4j.jar

PostPosted: Fri Jun 23, 2017 7:15 pm
by jason
please provide sample input docx and/or docx4j code to generate input docx.

Re: wordxml to pdf conversion issue with docx4j.jar

PostPosted: Fri Jun 30, 2017 1:38 am
by vinod.gvkr
Thanks Jason for the reply.

the code what i have used to tested :

PhysicalFont loFont = PhysicalFonts.getPhysicalFonts().get(
"Comic Sans MS" );
loFontMapper.getFontMappings().put( "Algerian", loFont );
org.docx4j.convert.out.pdf.PdfConversion loPDFConObj = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(
loWordMLPackage );
( (org.docx4j.convert.out.pdf.viaXSLFO.Conversion)loPDFConObj )
.setSaveFO( new java.io.File( fsSourceFile + ".fo" ) );
if( lboolSave )
{
( (org.docx4j.convert.out.pdf.viaXSLFO.Conversion)loPDFConObj )
.setSaveFO( new java.io.File( fsSourceFile + ".fo" ) );
OutputStream loResPDF = new java.io.FileOutputStream( lsResultPDF );
loPDFConObj.output( loResPDF, new PdfSettings() );
}

Thanks in advance.