Mi-Corporation Support

How can we help you today?

Text Wrapping for PDF Output

Modified on: Mon, 2 Nov, 2015 at 1:02 AM

If you are outputting your form to a PDF and you also have an InkEdit that has text without any spaces like "fffffffff" and it wraps to the next line, then the PDF generated will not automatically insert carriage returns and the text will go off the bounds of the inkEdit and overlap other parts of the form.

As a workaround here is some example code that checks the width of the inkEdit control and inserts carriage returns in appropriate places so the PDF output looks correct. It is possible that extra if conditionals may have to be added if the string in the inkEdit is too long and would require more than three carriage returns for it to fit properly.

To call that function, CheckWidth(), utilize something similar to this so it only reformats the inkEdit for the PDF then sets it back.

'store the value in the field so you can restore it later
Dim tempData As String = textField.Value
'send the field you will be checking
'set the max width you will allow in this field
'this number will need to be modified for your form field
CheckWidth(_InkEdit, 1000)
'run the PDF Export function - whatever you may call it
GeneratePDF()
'now set the original value back
textField.Value = tempData