1

Spipu,

I have created several forms that have 'fill in the blank' lines, e.g. First name: ________________

I have not found a good way of creating the underline blank section that html2pdf will render correctly. The only way I have found that works is as follows:

First name: <span style="text-decoration: underline; line-height: 200%;">SPACESPACESPACE...</span>

[The "SPACE" is really the HTML entity - ampersand nbsp semicolon - I can't type it because it will disappear when I post.]

That works OK, but when I have multiple long lines of blanks it takes up many times the space than it would using css.

The letters and forms are being created by the user in an HTML editor (YUI) and stored in a database. The letter/form is than processed from the database from HTML to PDF using html2pdf.

Thanks for any thoughts you have on this.

Bob

2

have you try to use a div with width and border-bottom ?
Ancien pseudo : lolo

3

Yes that works for full lines. However if I use the example - Name: ______ , then I get "Name:" underlined also, which I don't want. This can be used in a table and only apply the div to the cell for the underline, but become cumbersome when there are multiple different length lines with blanks, e.g.

Name: _____________ (to right margin)
Address: _______________ (to right margin)

That would require lots of different table columns and spans.

Still searching for a good solution.

Thanks.

4

I'll attach an example of the PDF I'm creating with some of the fields...

tromb Fichier joint : sample.pdf

5

Spipu (./2) :
have you try to use a div with width and border-bottom ?


I've used the following:

<div style="margin: 10px 20px 0px 10px; border-bottom-style: solid; border-bottom-width: 1px;"></div>

but it doesn't seem to be recognized by html2pdf. I'm still looking for a solution.

Thanks.

Bob

6

Never mind, I'm an idiot. I forgot the width.
Thanks Spipu.

7

and it works fine with width ?
Ancien pseudo : lolo

8

Spipu (./7) :
and it works fine with width ?


Almost. Its being created in the YUI editor and when viewed in the editor the line lines up at the bottom with the text. When I create the PDF the line is at the top of the cell instead of the bottom.

Here a snippet of code...

<table style="width: 100%; text-align: left;" cellspacing="0">
<tbody>
<tr>
<td style="width: 25%; vertical-align: bottom;">
Can you see the line?</td>
<td style="width: 75%; vertical-align: bottom;">
<div style="margin: 20px 20px 0px 5px; width: 100%; border-bottom-style: solid; border-bottom-width: 1px;"></div><br></td>
</tr>
</tbody>
</table>

Thanks.

9

I'll try and attach a screen shot of the editor and the resultant PDF.

tromb Fichier joint : z58Z (line.jpg)

tromb Fichier joint : line.pdf

10

it is because you have a <br> after your div...

try this :

<table style="width: 100%; text-align: left;" cellspacing="0">
	<tbody>
		<tr>
			<td style="width: 25%; vertical-align: bottom;">
				Can you see the line?
			</td>
			<td style="width: 75%; vertical-align: bottom;">
				<div style="margin: 20px 0 0 0; width: 100%; border-bottom-style: solid; border-bottom-width: 1px;"></div>
			</td>
		</tr>
	</tbody>
</table> 
Ancien pseudo : lolo

11

Spipu (./10) :
it is because you have a <br> after your div...


Thanks. I have tried to get rid of that pesky <br> for days. As I mentioned, this is an application for users. They are presented with an editor to create the HTML. To do that I'm using the (Yahoo) YUI editor. That darn editor keeps inserting the <br> after the <div>. Other than special processing to filter the HTML source after the user finishes the edit I'm not sure what I'll do.

Thanks again Spipu for your help.

Bob

12

as it is write in the homepage of html2pdf.fr : This library has been made to assist in the creation of PDF files, not to directly convert an HTML page.

in your case, you have to adapt you htlm code by remplace the <br>... try preg_replace smile
Ancien pseudo : lolo