I'm encountering difficulties with PDF generation on my website. After watching all three parts of the "Create Custom PDFs with PDF GENERATOR WiX Integration" tutorial series on YouTube, everything seemed to be going smoothly until I reached the section on implementing the button at the end of Part 3. While I can successfully generate a link with the custom PDF, I'm struggling to connect it to the "View PDF" button. As far as I can tell, the code appears to be correct, but I'm unable to resolve this issue on my own. Any assistance would be greatly appreciated. Thank you.
import {generatepdfFromdata} from "backend/pdfhelper"
import wixLocation from 'wix-location';
$w.onReady(function () {
let url;
$w("#submitButton").onClick(async ()=>{
const name = $w("#nameinput").value;
const content = $w("#contentinput").value;
const data = {name, content};
url = await generatepdfFromdata(data);
$w("#PDFbutton").link = url;
$w("#PDFbutton").target = "_blank";
console.log(url)
})
})
Hi Jayden,
It will be hard to assist you without seeing all the code related to this question. I'd also recommend adding some console logs to log the value of the url.
By the way, the solution in that tutorial is now available as an app in the Wix App Market: https://www.wix.com/app-market/pdf-generator
Best, Eitan