Mohit Jain
Mohit Jain

Reputation: 43919

Center align using html2pdf with lines on both side

<table style="width: 100%;">
        <tr>
            <td style="text-align: center;width=100%;"><h4>Education</h4></td>
        </tr>
</table>

This is the code I am using. Now i want o/p like this:

enter image description here

How can I draw these horizontal lines?

Upvotes: 1

Views: 15769

Answers (2)

Mohit Jain
Mohit Jain

Reputation: 43919

<table style="width: 100%; padding-top:-10px;">
            <tr>
        <td style="text-align: center;width=33%;"><hr style="height: .3mm; background: #000; "></td>
        <td style="text-align: center;width=33%; padding-top:-5px;">
<h4>Education</h4>
</td>
<td style="text-align: center;width=33%;"><hr style="height: .3mm; background: #000; ">     </td>
</tr>
</table>

This solved my problem.

Upvotes: 2

thirtydot
thirtydot

Reputation: 228152

If I paste http://fiddle.jshell.net/4QskF/show/light/ into the "enter a URL of your choice" box on the html2pdf homepage, I get output in the PDF which looks like your picture.

I used this HTML/CSS:

<div style="border-bottom: 1px solid #000"></div>
<h4 style="width:200px; margin:-10px auto 0 auto; text-align:center; background:#fff">Education</h4>

It might need some tweaks so you can actually use it in your document, but I think the idea works.

Upvotes: 3

Related Questions