Page 1 of 1

Log4j Warnings on PDF output file

PostPosted: Tue Aug 17, 2010 12:08 am
by heitorflorido
Hello,

I've successfully converted my docx to a PDF file, but I have some questions about the result:
1- Some log4j warnings appeared on the result file.
- I've downloaded the log4j.xml file from "src/main/resources", put it in my classpath, added "-log4j.configuration=lib/log4j.xml" to my VM args and then included in the file:
Code: Select all
<logger name="org.docx4j.convert.out.pdf.viaXSLFO">
   <level value="info"/>
</logger>

However, that didn't make the warnings disappear. What else I need to do?

2- On the output file, the left and bottom margin are set to 0, while the top and right margin are correct.
- How can I modify the margin values?

3- On some parts of the PDF, a '?' char appears at the begining of the sentence, but the docx doesn't show any char.
- How can I remove these '?' chars?

Thanks

Heitor Florido

Re: Warnings and Margins on PDF output file

PostPosted: Tue Aug 17, 2010 12:15 am
by jason
Re 1, try -Dlog4j.configuration=log4j.xml ?

Re 3, is this bullets/numbering?

Re 2 & 3, can you attach to this post a simple docx (renamed as zip) showing the probs?

Re: Warnings and Margins on PDF output file

PostPosted: Tue Aug 17, 2010 4:49 am
by heitorflorido
Hello,

Re 1: I've tried that too, but the messages remain.

Re 3: The docx contains lists and bullets, but they're OK.
Sample docx and pdf attached.
PS: I'm from Brazil, so the docx is written in Portuguese.

Thanks

Re: Log4j Warnings on PDF output file

PostPosted: Wed Aug 18, 2010 1:58 am
by jason
Re log4j, there are 2 steps:

1. Make sure your log4j configuration is being found (are you getting any log4j output at all?)

2. Ensure you have an entry for org.docx4j.convert.out.pdf.viaXSLFO.Conversion

(org.docx4j.convert.out.pdf.viaXSLFO should be OK, unless there is a more specific entry in the log4j config file)

What is your environment (eg command line, eclipse, tomcat)? I suspect the config file is not being found.

Re: Log4j Warnings on PDF output file

PostPosted: Wed Aug 18, 2010 11:27 am
by heitorflorido
I'm using Eclipse 3.6 and I have 3 folders at my project root dir.
the 'bin' folder contains all the compiled class files
the 'src' folder contains all the .java files
the 'lib' folder contains all .jar libraries and the log4j.xml
All libraries and the log4j.xml are in the project classpath.

When I run my program, I get this message:
log4j:WARN No appenders could be found for logger (org.docx4j.openpackaging.contenttype.ContentTypeManager).
log4j:WARN Please initialize the log4j system properly.


Thanks

Re: Log4j Warnings on PDF output file

PostPosted: Wed Aug 18, 2010 6:00 pm
by jason
That clearly indicates your log4j.xml file is not being found. (Or maybe its found, but not well formed?)

Here is my setup. In the run config, I have two things:

One, VM argument -Dlog4j.configuration=log4j.xml

Two, class path user entry being the folder containing log4j.xml

Re: Log4j Warnings on PDF output file

PostPosted: Fri Aug 20, 2010 3:27 am
by heitorflorido
Solved!

I moved my log4j.xml to another folder within the 'src' dir, added it to my classpath and it worked!

Thanks again jason