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

176
Views
pdfmake with Typescript/In StencilJS Project

I am using pdf maker in my StencilJs app using the official Documentation at https://pdfmake.github.io/docs/0.1/getting-started/client-side/ First of all, I have installed it via npm using:

npm install pdfmake

Then I have created the following to test the functionality:

import * as pdfMake from 'pdfmake/build/pdfmake';
import * as pdfFonts from 'pdfmake/build/vfs_fonts';


(<any>pdfMake).vfs = pdfFonts.pdfMake.vfs; 

export class PDFCreateService {


  constructor() {
 // empty
 }


public createNachrichtPDF(message: string): any {
 const fileName: string = 'ba-postfach-' + moment(new Date()).format('DD-MM-YYYY');

  const docDefinition = {
    content: [message]
  };


  return pdfMake.createPdf(docDefinition);
}

}

This code does not work and in the class My-Messages where I instantiate this class, I keep on getting the following error:

index-2022e853.js:2706 TypeError: Cannot read properties of undefined 
(reading 'pdfMake') at my-messages.entry.js:78239 undefined

Uncaught (in promise) Error: Constructor for "my-messages#undefined" was 
not found at initializeComponent

How can I solve this error?

about 4 years ago · Juan Pablo Isaza
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!