Line Feeds In MBS DynaPDF

The following code give me a nice mailing label that I put in a WebTextArea.

[code]my_return=address1_s+EndOfLine
IF address2_s <>"" then
my_return=my_return+address2_s+EndOfLine
end if

my_return=my_return+city_s+", "
my_return=my_return+st_s+" "
my_return=my_return+zip_s[/code]

Then I take the text and move it to a PDF and the EndOfLines get lost

In some cases it works and others it does not.

Am I missing some sort of encoding?

Did you inspect in debugger in the hex view of the bytes what line endings you have?
Not that you mixed them…

The image on the left, “Agent address” is also wrong.

I read something about EndOfLine.{Macintosh,OSX,Unix,Windows} in this thread.

@Alberto De Poo Yes, “Agent Address” is also wrong.

All 3 are generated using the same code. Hence the mystery.

@Christian Schmitz How do i do that?

I don’t know much about EndOfLines. What I would do is try EndOfLine.UNIX then EndOfLine.Windows to see if there is any difference.

I’m sure Christian will respond soon. I don’t know exactly but maybe is just put a break and inspect my_return, for example with EndOfLine.Windows you get 0D0A:

With EndOfLine.UNIX you just get 0A:

Maybe you just have 0A and you need 0D0A for your PDF? Sorry, if I’m wrong.

For what it is worth… the PDF document format doesn’t give a hoot about Linefeed characters, in much the same way that HTML doesn’t either … so any problems are with how or if the app (DynaPDF?) creates the file

How are you doing THAT part?

Have you tried

call pdf.WriteFTextEX(dfleft, dfTop, dfWidth,dfHeight, 0, Thetext)

And shouldnt your code be

[code]

my_return=ReplaceLineEndings (address1_s, endofline.windows)
IF address2_s <>"" then
my_return=my_return+address2_s+EndOfLine.windows
end if

my_return=my_return+city_s+", " +EndOfLine.windows
my_return=my_return+st_s+" " +EndOfLine.windows
my_return=my_return+zip_s[/code]

or endofline.unix or whatever, just so that it is consistent?

Well, if there is a bug, we need to reproduce it outside of your application.

As far as I see, WriteFText handles all kinds of combinations of EndOfLine character correctly, even mixed.

So what code do you use?
Maybe not WriteFText to write the block?

Jeff, I don’t think OP wants an EndOfLine between City, State and Zip, the format is City, ST ZIP in a single line

I’m new to ReplaceLineEndings. Does it work if address1_s is a single line with no EndOfLine?

by “works”…only affects text with a ENDOFLINE sequence… no EOL , then nothing happens

Thank you Dave.

That’s what I guessed. If address1_s is without EOL the ReplaceLineEndings will not add EOL

True.

So it probably does need to be

my_return=address1_s + endofline.windows //but it might already have one!!!

Anyway, the big question remains : HOW is the text being inserted into the PDF.
We know what the string can look like, but not the actual code being used.

The answer lay in the data itself. There were a bunch of hidden characters in the imported data. Teh hex view made them clear. Once the data was scrubbed, the problem “wen away”

Thanks all!