Forum Stats

  • 3,871,977 Users
  • 2,266,360 Discussions


PDF Viewer in APEX error in REST and getElementsByTagName()

Scott Sutherland
Scott Sutherland Member Posts: 15 Green Ribbon


Am reviewing the viewing of PDF in APEX and tried out the steps in the Oracle Developers "PDF Viewer in Oracle APEX"

Am working in

The code is explained at 1:43 and updated at 3:43 with the REST URL in the video.


error " ... 404 (Not Found) for code =

let afetch = await fetch("" + id);

Can anyone advise where I can find a solution? I am not familiar with REST so I'm not sure how to go about this, so I should probably read up more about this

2. getElementsByTagName

error "...TypeError: Cannot read properties of null (reading 'getElementsByTagName') at getData " for code

pdfContainer.getElementsByTagName("iframe") [0].src = blobUrl;

What could be the error? Code is as per demo - have experimented with using 'NULL' in place of '0" but no difference in the outcome

FYI full code snippet is

let id =; 
async function getData() {
    let afetch = await fetch("" + id);
  let blob = await afetch.blob();
  let blobUrl = URL.createObjectURL(blob);
  let pdfContainer = document.getElementById("pdfViewer");

  pdfContainer.getElementsByTagName("iframe") [0].src = blobUrl;