PDF-viewer

Hello, I have created a Bpmn program
now i have a problem with the preview of my document
in the second user task “reviwe document” I don’t get that displayed
Can you help me there ?

test.demo.bpmn (7.3 KB)

Hi,
try this out and let me know if it works :wink:

<script cam-script type="text/javascript">
    camForm.on('form-loaded', function () {
      camForm.variableManager.fetchVariable('attachment');
    });
    camForm.on('form-loaded', function () {
      fetch("http://localhost:8080/camunda/api/engine/engine/default/task/" + camForm.taskId + "/variables/attachment/data").then(function (response) {
        return response.blob();
      }).then(function (myBlob) {
        myBlob = myBlob.slice(0, myBlob.size, "application/pdf")
        var objectURL = URL.createObjectURL(myBlob);
        document.querySelector('#pdf-frame').src = '';
        document.querySelector('#pdf-frame').src = objectURL;
        objectURL = URL.revokeObjectURL(myBlob);
      });
    });
  </script>

Html

<embed class="col-sm-12" style="height:70vh;width:100%" type="application/pdf" id="pdf-frame">

Cheers