Automating PDF Access via API Calls for Login-Restricted Content in Glide Data Tables

You mean if our platform offer public URL without headers?

I mean is there way for you to call the URL, pass some authorization headers in, and then retrieve a public version that allows you to embed.

I am doing exact same thing calling the URL, passed some authorization headers and it should now display pdf and if you see the row is displaying “PDF” but I guess it is binary version of pdf

Yes, it is binary version of pdf is there a way to convert binary version to pdf in glide

I’m not aware of a way to do that. Hopefully someone else can chime in.

1 Like

Thank you for all the help so far.:slight_smile:

Not sure, but you can try creating some javascript in a javascript column that converts binary to a datauri. At the end of the day, the web embed only works with a public url or a datauri. That’s about it.

1 Like

by javascript column you mean this

yes

could you please tell me what am I doing wrong here :


Not tested, but try this.

function convertPdfToDataURI(pdfBlobOrArrayBuffer) {

  return new Promise((resolve, reject) => {
    const reader = new FileReader();

    reader.onload = function (event) {
      resolve(event.target.result);
    };

    reader.onerror = function () {
      reject("Error: Failed to read file");
    };

    const blob = pdfBlobOrArrayBuffer instanceof Blob
      ? pdfBlobOrArrayBuffer
      : new Blob([pdfBlobOrArrayBuffer], { type: "application/pdf" });

    reader.readAsDataURL(blob);
  });
}

return await convertPdfToDataURI(p1);
1 Like