Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

241
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda