Hi, I’m using apitemplate
through Retool to create PDF documents.
I send a POST request (create_pdf
) to apitemplate
with JSON in the body and receive the following response:
Example Response:
{
"download_url": "https://s3.ap-southeast-1.amazonaws.com/pub-cdn.apitemplate.io/2024/10/f3bb5ba0-a055-48e9-93c9-eb23377b4d37.pdf",
"transaction_ref": "f3bb5ba0-a055-48e9-93c9-eb23377b4d37",
"total_pages": 9,
"status": "success",
"template_id": "1a477b23ba5009d8"
}
I’m trying to open the PDF in a new tab and automatically trigger the print dialog with this code:
const pdfUrl = create_pdf.data.download_url;
const printWindow = window.open(pdfUrl);
if (printWindow) {
printWindow.focus();
printWindow.onload = function() {
printWindow.print();
};
}
However, the print window doesn’t open, and I receive the following error:
Blocked opening 'https://s3.ap-southeast-1.amazonaws.com/...pdf' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
Is there a way to deal with this sandboxing issue in Retool, and is it possible to automatically open the print dialog in this case?