Hello,
We want to have a pdf download automatically by the user on a page of the site. Is this possible?
Hello,
We want to have a pdf download automatically by the user on a page of the site. Is this possible?
With the click of a button, the link of the document can be opened in a new tab and can now be viewed.
You can install blobUtil npm + add a text element to the page and then do something like:
import {fetch} from 'wix-fetch';
import * as blobUtil from 'blob-util';
$w.onReady(function () {
fetch("https://some-file.pdf", {
method: 'GET'
}).then(resp => resp.blob())
.then(blob => {
const url = blobUtil.createObjectURL(blob);
$w("#text1").html = `<a href=${url} download>DOWNLOAD PDF</a>`;
})
});
i handle with html iframe
Many thanks,
<html>
<head>
<title>Page title</title>
<meta http-equiv="refresh" content="3; url=EXPORT LINK"/>
</head>
<body>
<p>Your download will automatically start in 3 seconds</p>
<p>Download does not start? click here: <a href="EXPORT LINK</a></p>
</body>
</html>