Thanks @jonatandor35
I have a premium site.
I don’t want the PDF opening in an iframe on the page and would prefer it to open in a new, separate window.
For the window.open(“”,“_blank”) is this being inserted into the backend code as detailed above, and if so where, or am I using it on the page itself?
Presently, I call the API on a button click as per below:
export async function generateQuote_click(event) {
$w("#total").value = +$w("#total1").value + +$w("#total2").value + +$w("#total3").value + +$w("#total4").value + +$w("#total5").value + +$w("#total6").value + +$w("#total7").value + +$w("#total8").value + +$w("#total9").value + +$w("#total10").value
const hospital = $w('#hospital').value
const address = $w('#address').value
const name = $w('#name').value
const phone = $w('#phone').value
const email = $w('#email1').value
const ref = $w('#finalRef').text
const date = $w('#date').text
const Name = $w('#iAm').value
const Phone = $w('#contact').value
const Email = $w('#email').value
const product1 = $w('#longProduct1').value
const code1 = $w('#article1').value
const box1 = $w('#boxQTY1').value
const qty1 = $w('#boxNum1').value
const price1 = $w('#boxPrice1').value
const total1 = $w('#total1').value
const product2 = $w('#longProduct2').value
const code2 = $w('#article2').value
const box2 = $w('#boxQTY2').value
const qty2 = $w('#boxNum2').value
const price2 = $w('#boxPrice2').value
const total2 = $w('#total2').value
const product3 = $w('#longProduct3').value
const code3 = $w('#article3').value
const box3 = $w('#boxQTY3').value
const qty3 = $w('#boxNum3').value
const price3 = $w('#boxPrice3').value
const total3 = $w('#total3').value
const product4 = $w('#longProduct4').value
const code4 = $w('#article4').value
const box4 = $w('#boxQTY4').value
const qty4 = $w('#boxNum4').value
const price4 = $w('#boxPrice4').value
const total4 = $w('#total4').value
const product5 = $w('#longProduct5').value
const code5 = $w('#article5').value
const box5 = $w('#boxQTY5').value
const qty5 = $w('#boxNum5').value
const price5 = $w('#boxPrice5').value
const total5 = $w('#total5').value
const product6 = $w('#longProduct6').value
const code6 = $w('#article6').value
const box6 = $w('#boxQTY6').value
const qty6 = $w('#boxNum6').value
const price6 = $w('#boxPrice6').value
const total6 = $w('#total6').value
const product7 = $w('#longProduct7').value
const code7 = $w('#article7').value
const box7 = $w('#boxQTY7').value
const qty7 = $w('#boxNum7').value
const price7 = $w('#boxPrice7').value
const total7 = $w('#total7').value
const product8 = $w('#longProduct8').value
const code8 = $w('#article8').value
const box8 = $w('#boxQTY8').value
const qty8 = $w('#boxNum8').value
const price8 = $w('#boxPrice8').value
const total8 = $w('#total8').value
const product9 = $w('#longProduct9').value
const code9 = $w('#article9').value
const box9 = $w('#boxQTY9').value
const qty9 = $w('#boxNum9').value
const price9 = $w('#boxPrice9').value
const total9 = $w('#total9').value
const product10 = $w('#longProduct10').value
const code10 = $w('#article10').value
const box10 = $w('#boxQTY10').value
const qty10 = $w('#boxNum10').value
const price10 = $w('#boxPrice10').value
const total10 = $w('#total10').value
const notes = $w('#warrantyFinal').text
const total = $w('#total').value
const pdfUrl = await getPdfUrl({hospital, address, name, phone, email, ref, date, Name, Phone, Email, product1, code1, box1, qty1, price1, total1, product2, code2, box2, qty2, price2, total2, product3, code3, box3, qty3, price3, total3, product4, code4, box4, qty4, price4, total4, product5, code5, box5, qty5, price5, total5, product6, code6, box6, qty6, price6, total6, product7, code7, box7, qty7, price7, total7, product8, code8, box8, qty8, price8, total8, product9, code9, box9, qty9, price9, total9, product10, code10, box10, qty10, price10, total10, notes, total})
wixLocation.to(pdfUrl);
}
I tried adding it to a few locations in both sets of code and could not get it to work.
e.g.
const pdfUrl = await getPdfUrl({hospital, address, name, phone, email, ref, date, Name, Phone, Email, product1, code1, box1, qty1, price1, total1, product2, code2, box2, qty2, price2, total2, product3, code3, box3, qty3, price3, total3, product4, code4, box4, qty4, price4, total4, product5, code5, box5, qty5, price5, total5, product6, code6, box6, qty6, price6, total6, product7, code7, box7, qty7, price7, total7, product8, code8, box8, qty8, price8, total8, product9, code9, box9, qty9, price9, total9, product10, code10, box10, qty10, price10, total10, notes, total})
wixLocation.to(pdfUrl);
getPdfUrl.target = "_blank";//NEW
and this in the backend code which then causes the process to break:
export async function getPdfUrl(data) {
const {response} = await Client.output(templateID, data, undefined, undefined, {output: 'url'})
response.target = "_blank";//NEW
return response
}