PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → UBL with embedded PDF
UBL with embedded PDF
Iniciado por guest, 26,feb. 2018 16:03 - 3 respuestas
Publicado el 26,febrero 2018 - 16:03
Hi,

We are working on the creation of UBL files (invoices) with embedded PDF. The PDF must be encoded in base64. We managed to do this using the code
LsBase64Content is string = Encode(fLoadBuffer(LsFileName), encodeBASE64) When we test our UBL files on https://v2.validex.net/ then mostly we get the answer 'Length of base64 value must be a multiple of four'. So approximate 1 on 4 invoices are passing the test because the length of the string is a multiple of 4.
We also tried with Crypt but this gives exactly the same result.
LsBase64Content is string = Crypt(fLoadBuffer(LsFileName),"",compressNone + cryptNone, encodeBASE64)
How can we fix that the length is a multiple of 4 and that the PDF can be retrieved by any other software?

Thank you for your advice!

Regards,
Joris
Publicado el 26,febrero 2018 - 18:56
Hi Joris,

that is strange... AFAIK, the encodebase64 option DOES create a 4s multiple length string (it completes the end with == if necessary)...

So I would start by doing an info(lenght(LsBase64Content)) to check that first, and if I'm correct tna dthey all rare multiples of 4, look or the problem somewhere else... Perhaps in the way you are constructing your ubl files.

best regards
Publicado el 26,febrero 2018 - 19:05
Are you using VariantToJSON or something like that?

VariantToJSON and encode base64 is a mess.
I don't know if the same happens with XML.
Publicado el 27,febrero 2018 - 17:27
Thank you Fabrice, you are right!

We made an error in our code that removed these = signs :rolleyes:

Kind regards,

Joris