title: How to use velocity to create pdf files?
body: <p>In our application, we have velocity code which generates csv and html reports.
  Now we want to add pdf support to it.  </p>
  
  <p>So i tried exploring way. But found that we can not generate pdf from velocity. 
  so it will be something like first create docx and then from docx to pdf. </p>
  
  <p>I am ok with this way also.  </p>
  
  <p>I already have .vm file which is something like:</p>
  
  <pre><code>#if ($file.getRecords().size() != 0) 
  </code></pre>
  
  <p>bla bla bla....</p>
  
  <p>My java code replaces $file with </p>
  
  <pre><code>VelocityContext context = new VelocityContext();
      context.put("file", fileCatalog);   
  </code></pre>
  
  <p>where filecatalog is clonnable class and has mmethod getrecords ...etc etc.</p>
  
  <p>this setup is perfectly working for csv and html output generation.
  but for docx generation, its saying docx is corrupt and cannot be opened.</p>
  
  <p>any idea whats wrong in it?</p>
  
  <p>I wanted pdf as final output. since its not possible directly, so chose making docx first but docx is also giving problems....
  request you to please guide....</p>
  
  <p>TIA!</p>