What I would like to do is to fetch the pdf via "fetch" and then download it on the users browser, instead of making them open another tab with the link to the API, so that users would be able to download it without having to leave the page.
This was my first approach of doing it
fetch("https://latexonline.cc/compile?url=https://raw.githubusercontent.com/aslushnikov/latex-online/master/sample/sample.tex")
.then(response => response.blob())
.then(blob => {
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = "filename.pdf";
document.body.appendChild(a);
a.click();
a}
);
I even tried this while on latexonlice.cc in the console, but it didnt work either. It just downloads an empty pdf file, so maybe i'm not doing it right.
It does work now if you attempt from latexonline.cc. However, I'm hesitant to enable CORS since iframe should be good-enough for all expected usecases.
Hi, im having a similar issue as #30
What I would like to do is to fetch the pdf via "fetch" and then download it on the users browser, instead of making them open another tab with the link to the API, so that users would be able to download it without having to leave the page.
This was my first approach of doing it
I even tried this while on latexonlice.cc in the console, but it didnt work either. It just downloads an empty pdf file, so maybe i'm not doing it right.
Is there any way of doing this?
Thanks!