So to do what you're trying to do in your DTL, add in a code block and paste in the following:
Set CHUNKSIZE = 2097144
Set outputStream=##class(%Stream.TmpCharacter).%New()
Do source.EncodedPdf.Rewind()
While ('source.EncodedPdf.AtEnd) {
Set tReadLen=CHUNKSIZE
Set tChunk=source.EncodedPdf.Read(.tReadLen)
Do outputStream.Write($SYSTEM.Encryption.Base64Encode(tChunk,1))
}
Do outputStream.Rewind()
Set Status = target.StoreFieldStreamRaw(outputStream,"OBXgrp(1).OBX:5.5")
)
Yours is almost doing the same thing but, as Enrico points out with your code sample, you have the "Set tSC = tStream.Write($C(10))" line adding in the line breaks whereas my example has this excluded.
Separately, as alluded to by Scott, when adding the base 64 encoded PDF stream to the HL7, you'll want to use the StoreFieldStreamRaw method for the HL7. Trying to do a traditional set with a .Read() risks the input being truncated.
Hey Smythe.
Your Base64 has line breaks, so is breaking onto a new line which is then being read as a new line in the HL7.
Depending on what method you are using to convert the PDF to Base 64, you should have a setting to not use line breaks.
Please look here for the solution: https://community.intersystems.com/post/base-64-message-taking-consideri...