Forum


Replies: 2   Views: 2829
Issue with generating pdf from docx with table
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin@wotbot.com.au  · 12-01-2018 - 02:56

Whenever I try to render pdf from docx with tables, there's a noticeable difference with the pdf output from the docx generated.
I rendered the docx using `replaceVariableByHTML` and the docx outputs as expected. Here's the html that was added

<style>
 /*header and footer*/

 div.contents {
  border-style: solid;
  border-color: black;
  border-width: 1px;
 }

 table, td, tr {
  border-collapse: separate;
  border-style: solid;
  border-color: black;
  border-width: 1px;
  width: 100%;
  vertical-align: text-top;
 }

 tr.main-row {
  min-height: 600px;
  /*margin: 2px;*/
 }

 td {
  /*background-color: cyan;*/
  margin: 2px;
 }

 .img-tags {
  max-height: 100px;
 }

 u {
  text-decoration: underline;
 }

 span.red {
  color: red;
 }

</style><div class="contents">
 <hr>
 <table>
     
   <tr class='main-row'>
         <td colspan="2"><p>Client Name:&nbsp;<span class="red">[Client: Client Name]</span></p>

<p>Client Address: <span class="red">[Client: Client Delivery Address]</span></p></td>
         <td colspan="2"><p>Organization Name:&nbsp;<span class="red">[Account: Organization Name]</span></p>

<p>Organization Email:&nbsp;<span class="red">[Account: Organization Email]</span></p></td>
       </tr>
     
   <tr class='main-row'>
         <td colspan="4"><p>Engagement Title:&nbsp;<span class="red">[Engagement: Name]</span></p></td>
       </tr>
   </table>
</div>

Could you tell me what's wrong?
I could send the generated pdf and docx. I tried converting the docx using terminal, the issue still exists. Thanks

Posted by admin  · 12-01-2018 - 07:18

Hello,

We recommend you to read the good practices when working with the conversion plugin available on:

https://www.phpdocx.com/documentation/conversion-plugin/preparing-the-templates-for-its-conversion

For example, you must use specific width values for tables, rows and cells (instead of using automatic values). And use the conversion plugin based on LibreOffice to get the best output.

If you need more tips to get the best output you can send both files (DOCX and PDF) to contact[at]phpdocx.com and the dev team will check them.

Regards.

Posted by admin  · 12-01-2018 - 07:19

Hello,

We recommend you to read the good practices when working with the conversion plugin available on:

https://www.phpdocx.com/documentation/conversion-plugin/preparing-the-templates-for-its-conversion

For example, you must use specific width values for tables, rows and cells (instead of using automatic values). And use the conversion plugin based on LibreOffice to get the best output.

If you need more tips to get the best output you can send both files (DOCX and PDF) to contact[at]phpdocx.com and the dev team will check them.

Regards.