Printpdf Function

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

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

Try that and it did not work.

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.

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

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

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

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

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.

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

Can you please, look at the project below. I am transferring the content of a chart to a container using two forms. Everything works fine, but when I run the PrintPDF function the chart does not come up on the pdf, only its borderline. I will appreciate if you indicate what needs to be changed to make it work.

Thanks

esteban

PrintPDFsamplewithchart.appstudio.zip (12.4 KB)

I am also struggling with print2pdf on an ipad. What seems to have helped is to update the extraheader to the latest version on cloudflare i.e.

…om/ajax/libs/jspdf/1.4.1/jspdf.d…

It could be worth a try.

regards Richard

Thanks for the info. I did changed the header. It worked somehow…it shows the pdf form super magnified and only a portion of it,(See PDF file) and black and white. What site can I find the latest version of the headers? Any other ideas.

Thanks

This site blocks any links being posted. I did a search for cloudflare and jspdf and it comes up.

regards Richard

Hi RichardC,

You should be able to post links fine. If you mean you’re having trouble posting strings starting with a <, try putting the inside triple left ticks:

<script> ...</script>

Here’s a screenshot of my edit window for the above text:
41%20PM

Hi George, I had put in the full URL starting HTTPS and it was bounced as being spam thus:
Hello,

This is an automated message from AppStudio to let you know that your post was hidden.

Your post was flagged as spam : the community feels it is an advertisement, something that is overly promotional in nature instead of being useful or relevant to the topic as expected.

Multiple community members flagged this post before it was hidden, so please consider how you might revise your post to reflect their feedback. You can edit your post after 10 minutes, and it will be automatically unhidden.

However, if the post is hidden by the community a second time, it will remain hidden until handled by staff.

For additional guidance, please refer to our community guidelines.

So I edited the post as you saw, kind regards Richard

The web forum software checks for spammy messages using a number of criteria. One of them is multipole links to the same site, which is what affected your message.