Encoding issue with Base64.encodeString()

Home Forums Convertigo Products Encoding issue with Base64.encodeString()

This topic contains 3 replies, has 2 voices, and was last updated by  Gregory Vorbe 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #235951

    Emilien Nicolas
    Participant

    Hello,
    I’ve tried to use, in a SequenceJs, a static method Packages.com.twinsoft.convertigo.engine.util.Base64.encodeString() because I need to encode a pdf to Base64.
    I have the raw pdf with org.apache.commons.io.FileUtils.readFileToString(file, "ISO-8859-1");
    Does it works the same way as window.btoa in javascript? Because I don’t have the same string when I use convertigo and when I use javascript btoa.

    Sincerely,
    Émilien Nicolas

    #235973

    Gregory Vorbe
    Moderator

    Hello Emilien,

    window.btoa(string) and Packages.com.twinsoft.convertigo.engine.util.Base64.encodeString(string) are working the same for ASCII strings.
    I am not sure that org.apache.commons.io.FileUtils.readFileToString(file, “ISO-8859-1″) keeps the integrity of the PDF binary file.
    I would suggest you to use instead the following Convertigo helper method:

    Packages.com.twinsoft.convertigo.engine.util.Base64.encodeFromFile(String filePath)

    This will encode to Base64 a given local file (absolute file path) and return it as a string.

    QA&Support

    #235974

    Emilien Nicolas
    Participant

    Hello,
    Thank you, it work perfectly.
    Is there a way to find the different methods provided by the convertigo package?

    #235975

    Gregory Vorbe
    Moderator

    Unfortunately, Packages are not documented and does not have completion in code editor.
    You can browse source files at https://sourceforge.net/p/convertigo/code/HEAD/tree/CEMS_opensource/trunk/Studio/src/com/twinsoft/convertigo/ for public methods available.

    QA&Support

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.