IDM Cloud - Transform PDF octet-stream to base64

Hi Everybody,

For one client i need to upload a pdf in IDM. i developed a dataflow and use IDM API to get the PDF content (using ION REST API IDM/api/items/{pid}/resource/stream). The APIs send an octet-stream.

Then, i try to merge it with a fusion python script in my ProcessContentDocument BOD. The script works.

Problem, the PDF comes to IDM perfectly but the content is damaged. I think that the base64 binary is wrong (maybe my python method is not well coded).

Do you have an idea please ?

Tagged:

Best Answers

  • Brandon Watson
    Brandon Watson Member, Infor Partner Posts: 25
    Answer ✓

    Hello Pierrick - Below are the two lines of code I have successfully used with the octet-stream and getting a base64 encoded string. Hopefully this works for you.

    encodedBytes = base64.b64encode(input_var_1)

    base64_item_var = str(encodedBytes, "utf-8")

Answers

  • Pierrick
    Pierrick Member Posts: 2

    Hi Brandon,

    It works perfectly and also with a Binary typed parameter (instead of String) for the python fusion script.

    Thanks you very much