Page 1 of 1

pdf output does not match word

PostPosted: Thu Nov 10, 2011 8:33 am
by fachhoch
I tried pdf generation and never it created one similar to word , pdf is adding lot of minus signs, some places it removes the blank line .... etc.

does pdf works for all others? what is work around to make pdf right ?

Re: pdf output does not match word

PostPosted: Thu Nov 10, 2011 9:09 am
by jason
You'll need to post your input docx (or preferably a simplified test case) and the resulting pdf.

"Lots of minus signs" doesn't sound normal...

Re: pdf output does not match word

PostPosted: Thu Nov 10, 2011 9:33 am
by fachhoch
mytest.zip
eclipse project
(15.25 KiB) Downloaded 146 times

ADL-new-3.pdf
generated pdf
(55.08 KiB) Downloaded 243 times

ADL-new.docx
generated odcx
(10.58 KiB) Downloaded 138 times

test.docx
file my com.test.mine.docx4j.Docx4jTest uses
(11.62 KiB) Downloaded 173 times

Attached my eclipse project , my java class com.test.mine.docx4j.Docx4jTest uses ,thanks a lot for your help.

Re: pdf output does not match word

PostPosted: Thu Nov 10, 2011 9:52 pm
by jason
The "dashes" actually look to be underlines, coming from an empty paragraph:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
    <w:p w:rsidRDefault="005A0D87" w:rsidP="005A0D87" w:rsidR="005A0D87" w:rsidRPr="00A73B79">
      <w:pPr>
        <w:rPr>
          <w:b/>
          <w:u w:val="single"/>
        </w:rPr>
      </w:pPr>
    </w:p>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


This is because in the case of an empty paragraph, Conversion.java is adding a space:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                        // Handle empty case - want the block to be preserved!
                        if (n.getChildNodes().getLength()==0) {
                               
                                ((Element)foBlockElement).setAttribute( "white-space-treatment", "preserve");
                                foBlockElement.setTextContent(" ");

 
Parsed in 0.015 seconds, using GeSHi 1.0.8.4

Re: pdf output does not match word

PostPosted: Fri Nov 11, 2011 2:24 am
by lucasfgc
Jason,

So, how to add a new line (blank one)?

Re: pdf output does not match word

PostPosted: Fri Nov 11, 2011 5:05 am
by fachhoch
Jasaon/Lucas,
any updates on this ? is this something whihc can fixed by overriding some method ?

Re: pdf output does not match word

PostPosted: Fri Nov 11, 2011 9:46 am
by jason
You can work around this issue by removing the underline from the empty paragraphs in Word.

The correct fix will require a change to docx4j.