Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
Convert Lit Template into PDF

I am struggling to convert a lit template into pdf. I am using jsPDF (although I can use another javascript library if needed)

I have the following lit template to export into pdf

import { LitElement, html } from 'lit';
import { jsPDF } from "jspdf";

export class TestPage extends LitElement {
static properties = {
    myHTML: { type: Object },
  };

constructor() {
super();
this.myHTML = html`<h1>My title</h1>
  <div>some text to export to pdf</div>`;
this.doc = new jsPDF();
this.doc.text(this.myHTML, 10, 10);
  }
}
customElements.define('test-page', TestPage);

jsPDF returns:

Uncaught Error: Type of text must be string or Array. "[object Object]" is not recognized.

I do not have the option to render the lit template first before exporting it. I need to use the variable as a HTML source.

Thanks for any hints.

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!