Download Content on Webflow as a PDF

Hello!

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?

Many thanks!!

Read-Only Link:
https://preview.webflow.com/preview/airesume?utm_medium=preview_link&utm_source=designer&utm_content=airesume&preview=fa827dd1eb02613f1fde0aef4cc2271d&pageId=63eff420cc0f5e5ea2eb85ac&workflow=preview

@Satzuma this is my got to approach, maybe it’ll work for you as well?

Hello Chris!

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.


Read-Only Link:
https://preview.webflow.com/preview/airesume?utm_medium=preview_link&utm_source=designer&utm_content=airesume&preview=fa827dd1eb02613f1fde0aef4cc2271d&pageId=63eff420cc0f5e5ea2eb85ac&workflow=preview


Note: The ID of the Resume(element) to download as a pdf is “content”, and the button to generate that pdf has an ID “download-pdf”.

script src=“https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.4.0/jspdf.umd.min.js”
script src=“https://github.com/jbarlow83/OCRmyPDF/releases/download/v12.2.6/ocrmypdf-12.2.6-all.deb.js”

// 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();
    });
  }
});

} catch


Why not only add the div block to the template, or whatever you want to convert into a PDF?