Hello,
how can I access Files in the tulip table from custom widget ?
In a custom widget, I would like to open PDF stored in tulip table, but when I try, I get an error:
from origin ‘null’ has been blocked by CORS policy
Here is my code to get the content of the PDF stored in the variable “pdf_link”:
async function test() {
let pdf_link = getValue(“pdf_link”);
const response = await fetch(pdf_link);
if (!response.ok) {
throw new Error(
"Erreur lors de la récupération du fichier : " + response.statusText
);
}
const blob = await response.blob();
const file = new File([blob], “document.pdf”, { type: blob.type }); // Simule un fichier
}
test();
I am wondering a bit more about your use case here - what are you trying to accomplish by opening a PDF from a Tulip Table with a custom widget? I am wondering if there is another way to approach this
I meant the signURL API.
The Docs and images are stored as a blob and not as a public link. This link will not work from an external source.
You can sign this url and will get one back, that is available for 3 hours or so.