Printpdf Function


#1

I am learning to use the Printpdf Function. Problem I am having is that when I create a textbox and format its contents like to skip a line, (below) when I run the program the pdf form created does not format as on the text, and just stays in the same line, whereas in the textbox is formatted correctly. Anything I am missing to be able to format the pdf form as in the textbox or container?

Dim pdf = new jsPDF("p", "pt", "letter")

TextArea1.value  = "Testing 1" + Chr(13) + "Testing 2"
HTMLview1.innerHTML= TextArea1.value
function Button1_onclick()
  Form1.style.display = "inline"
  HTMLview1.innerHTML= TextArea1.value
  pdf.addHTML(document.body, handlePDFdone)
End function

Sub handlePDFdone()
 pdf.save()
 'FormattedPage.style.display = "inline"
 Form1.style.display = "inline"
End Sub

#2

Since the text is HTML, try using "<br>" to go to a newline, instead of Chr(13).


#3

Try that and it did not work.


#4

Noticed that
without the brackets br works fine if I place the info in the innerHTML property box. However, if I try to use it the same
or chr(13) or vbCRLF in regular code they do not format the HTMLview.innerHTML. Can not process text information in the property box because results are selected by user and not me, and then transfer to the innerHTML using HTMLview1.innerHTML= TextArea1.value. I am able to trasnfer the text value to the HTML but all formatted info is ignored by the HTML and not the TextArea and just prints the info in the pdf ignoring any line breaks…

Like:

HTMLview2.innerHTML="1 " + <br> "2" or HTMLview2.innerHTML="1 " + <chr(13)> +  "2"

or

HTMLview2.innerHTML="1 " + <vbCRLF> "2"

Any Ideas.


#5
TextArea1.value  = "Testing 1<br>Testing 2"

#6

Thanks, TextArea1.value = “Testing 1
Testing 2” works fine. However formatting does not work if you use variables. Check code below.

Thanks

esteban

Dim pdf = new jsPDF("p", "pt", "letter")

Dim Name

Name = " John "

Last = "Doe "

Age = "50 "

' Using <br>, chr(13) vbCRLF does not work can try it with line below, it will not format the variables:

'TextArea1.value  = "Testing 1<br>Testing 2<br>Testing 3<br><br>Testing4<br>" + Name<br> + Last<br> + Age

'If do not use <br> variables work fine, try line below:

TextArea1.value  = "Testing 1<br>Testing 2<br>Testing 3<br><br>Testing4<br>" + Name +  Last +  Age

HTMLview1.innerHTML= TextArea1.value

function Button1_onclick()

Form1.style.display = "inline"

HTMLview1.innerHTML= TextArea1.value

pdf.addHTML(document.body, handlePDFdone)

End function

Sub handlePDFdone()

pdf.save()

Form1.style.display = "inline"

End Sub

#7

'<br>' is not a variable. It’s just 4 characters in the string.


#8

Why doesn’t
work when I use variables? It types correct value of variable but does not format. Anyway to make it work?

TextArea1.value  = "Testing 1<br>Testing 2<br>Testing 3<br><br>Testing4<br>" + Name<br> + Last<br> + Age  

Thanks


#9

Do you get a syntax error when you run it?

The statement starts out OK, but loses it after the + Name. "<br>" is a string and needs quotes around it.


#10

Format now! was not aware of needs of quotes. Thank You!