Page 1 of 1

docx to PDF - DrawingML & VML

PostPosted: Mon Dec 26, 2011 7:36 am
by EvandroContato
I'm having some problems to convert my docx file to pdf, I researched a lot here in the forum before posting my question but could not find the solution.

Errors that occur are:

Code: Select all
WARN Conversion org.docx4j.convert.out.pdf.viaXSLFO.Conversion.notImplemented(Conversion.java:478)
Mensagem: NOT IMPLEMENTED: support for wp:inline
without pic:pic

ERROR Conversion org.docx4j.convert.out.pdf.viaXSLFO.Conversion.createBlock(Conversion.java:828)
Mensagem: java.lang.NullPointerException

WARN Conversion org.docx4j.convert.out.pdf.viaXSLFO.Conversion.notImplemented(Conversion.java:478)
Mensagem: NOT IMPLEMENTED: support for w:pict
without v:imagedata


My docx file contains text and images someone would have an example of how to convert my docx file to pdf?

docx file attached my

Thank you all and Merry Christmas,

Evandro

Re: Convert DOCX to PDF

PostPosted: Tue Dec 27, 2011 11:17 am
by jason
The first "image" is a SmartArt diagram:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
       <w:drawing>
          <wp:inline distT="0" distB="0" distL="0" distR="0">
            <wp:extent cx="5486400" cy="3124200"/>
            <wp:effectExtent l="0" t="0" r="0" b="0"/>
            <wp:docPr id="1" name="Diagram 1"/>
            <wp:cNvGraphicFramePr/>
            <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
              <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/diagram">
                <dgm:relIds xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:dm="rId6" r:lo="rId7" r:qs="rId8" r:cs="rId9"/>
              </a:graphicData>
            </a:graphic>
          </wp:inline>
        </w:drawing>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


The diagram is described in DrawingML, and docx4j is unable to convert this to PDF.

Subsequent ones are VML, for example:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
        <w:pict>
          <v:shapetype id="_x0000_t34" coordsize="21600,21600" o:spt="34" o:oned="t" adj="10800" path="m,l@0,0@0,21600,21600,21600e" filled="f">
            <v:stroke joinstyle="miter"/>
            <v:formulas>
              <v:f eqn="val #0"/>
            </v:formulas>
            <v:path arrowok="t" fillok="f" o:connecttype="none"/>
            <v:handles>
              <v:h position="#0,center"/>
            </v:handles>
            <o:lock v:ext="edit" shapetype="t"/>
          </v:shapetype>
          <v:shape id="_x0000_s1042" type="#_x0000_t34" style="position:absolute;margin-left:105.5pt;margin-top:62.8pt;width:202.75pt;height:29.25pt;z-index:251670528" o:connectortype="elbow" adj="7202,-240923,-18910">
            <v:stroke startarrow="block" endarrow="block"/>
          </v:shape>
        </w:pict>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


Docx4j is currently unable to convert arbitrary VML.

If the DrawingML or VML merely points to an image, docx4j can include that in the PDF. Cases like yours however, which require interpreting the vector language, are currently not supported.

If we were to handle the VML, it would probably be by converting it to SVG. (Similarly for basic DrawingML support, though the SmartArt stuff is another layer on top of that altogether. Docx4j contains some support for programmatically generating SmartArt which Word and Powerpoint can consume, but that is quite different from converting it to PDF.)