I have designed a Template (Resume/Cover Letter), with webflow that is dynamically populated by user input. How can i make the template (element/form/content…) download as a PDF?
This script works → I currently use this script to download the Template (element). But the quality is terrible as its only a screenshot (No OCR, text is not searchable).
Template ID = “Content”
Button Class = “download-pdf”
’
Any suggestions on how to do accomplish this on webflow, with or without scirpts?
Thanks for sharing this. I have tried it and it seem to be working. However - it downloads the entire (CMS) site and not a part of the site like a div block (ex.resume template) where the desired content (element) to download as a PDF is located, because CloudConvert asks for a URL as a caption option.
According to chatGPT, this (attached) script should work, but it doesnt. (note; another script worked but it only generated a screenshot (picture) of the Resume (element) - Bad quality and not searchable text as OCR).
How do people using Webflow do when they want users to download a dynamic content as a PDF? This should be a common task.
// get the download-pdf button and content element
const downloadPdfBtn = document.getElementById(‘download-pdf’);
const contentEl = document.getElementById(‘content’);
// add event listener to the download-pdf button
downloadPdfBtn.addEventListener(‘click’, async () => {
try {
// create a new jsPDF instance
const doc = new jsPDF();
// add the content to the PDF
doc.html(contentEl, {
callback: function (doc) {
// get the PDF data as a blob
const pdfBlob = doc.output('blob');
// OCR treat the PDF data using OCRmyPDF
OCRmyPDF(pdfBlob, pdfBlob, {
deskew: true,
rotate_pages: true,
remove_background: true,
optimize: 3
}).then((result) => {
// create a download link for the OCR treated PDF
const downloadLink = document.createElement('a');
downloadLink.href = URL.createObjectURL(result);
downloadLink.download = 'content.pdf';
downloadLink.click();
});
}
});