https://www.youtube.com/watch?v=ffj0ycGg-m0&t=603s - used this video to create my own PDF generator and copied it step by step.
unfortunately getting the error which I have attached.
thanks in advance!
website:
code =
import { generateNote } from 'backend/notecharm.jsw';
import { generatePDF } from '@the-wix-wiz/pdf-generator-backend';
import { getDownloadUrl } from 'backend/media';
import wixLocationFrontend from 'wix-location-frontend';
$w.onReady(function () {
// Click event handler for generating notes
$w("#askButton").onClick(async () => {
$w('#loadingAnimation').show();
const customerInfo = $w("#promptInput").value;
const orderInfo = $w("#promptInput1").value;
const vendorInfo = $w("#promptInput2").value;
const noteWriterInfo = $w("#promptInput3").value;
const combinedInput = `${customerInfo} ${orderInfo} ${vendorInfo} ${noteWriterInfo}`;
try {
const generatedNote = await generateNote(combinedInput); // Pass the combined input as a single parameter
$w("#answerText").text = generatedNote;
$w("#answerText").show();
$w('#loadingAnimation').hide();
} catch (error) {
console.error(error);
// Handle any errors
}
});
// Click event handler for downloading PDF
$w('#downloadPDFButton').onClick(async () => {
try {
const pdf = await generatePDF("https://www.notecharm.com/pdf", "NoteCharm PDF");
const downloadUrl = await getDownloadUrl(pdf.fileUrl);
console.log("download url", downloadUrl);
wixLocationFrontend.to(downloadUrl);
} catch (error) {
console.error(error);
// Handle any errors
}
});
});
Thanks for sharing!
Can you please provide a screenshot of the backend logs?
Dashboard> dev tools> logs > view logs