Get PDF from a base64 string

Hello! i have a Base64 encoded string that i need to convert to PDF for printing (something like this service https://base64.guru/converter/decode/pdf).
Is there a way to do it in xojo?

Thanks!

The data that is IN the BASE64 string is not already formatted PDF data?
and you wish to decode the string, and convert to PDF?

The will take something like my gPDF class (or something similar)

[quote=444876:@Matteo Lovatti]Hello! i have a Base64 encoded string that i need to convert to PDF for printing (something like this service Base64 to PDF | Base64 Decode | Base64 Converter | Base64).
Is there a way to do it in xojo?

Thanks![/quote]

You can decade BASE 64 in Xojo
https://documentation.xojo.com/api/text/encoding_text/decodebase64.html

and that should just be a A PDF that you can save to disk and open/print with any PDF reader

  • karen

The unanswered question is if the “string” is already in PDF format or not… the way I read his question it isn’t

However the website he cited, does require the BASE64 string to be a valid PDF data

In MacOS and Windows (8.1 / 10), you can print data* to pdf. I do not know if this is also built-in Linux.

  • Place the data to print in a TextArea, then print it to PDF using the virtual printer (both platforms).

[quote=444882:@Dave S]The unanswered question is if the “string” is already in PDF format or not… the way I read his question it isn’t

However the website he cited, does require the BASE64 string to be a valid PDF data[/quote]

It think it’s already a PDF as the web service works correctly with it.

i’ll look at you class and at the function that @Karen Atkocius has suggested.

Thanks a lot guys!

I guess the base64 file is from a PDF, I saw this on that page:

[quote]Important notes about the decoder
The “Base64 to PDF” converter will force the decoding result to be displayed as a PDF file, even if it is a different file type. Therefore, if you are not sure that your Base64 string is a PDF, use the Base64 to file converter since it is capable of displaying various file types. In any case, feel free to give it a try, since this converter will inform you if something is wrong.[/quote]