Load doc in camunda via api as blob

Hello,

i want to download and display a pdf in the camunda engine.

My idea is to make a Service-Task (http-connector) that request my own API and get a base64 as response. The response would be process as Inline-Script in JavaScript:

var response = connector.getVariable('response');

var file = Java.type('org.camunda.bpm.engine.variable.Variables')
             .fileValue('test.pdf')
             .file(response)
             .mimeType('application/pdf')
             .create()

execution.setVariable('mypdf.pdf', file)

Later i will display it in a external Form-Task as object.

<object data="mypdf.pdf" type="application/pdf">
  • It’s possible to achieve my goal with the described way?
  • Which format need camunda to process the pdf ? Binary/Blob/Base64… ?
  • It´s nessesary to send a special typ (binary/base64…) or its enough to send raw pdf? (http-connector url → Startseite | Jena Lichtstadt)

Thanks!