AmirTugi / tea-school

Simplified HTML + CSS --> PDF Generator for Nodejs
343 stars 31 forks source link

Emoji support #13

Closed oneEyedSunday closed 5 years ago

oneEyedSunday commented 5 years ago

Hello @AmirTugi I'm printing something that involves emojis. They come out mangled like this

Screenshot 2019-06-14 at 2 47 57 PM

do I have to make any adjustments to the config, like encoding settings, since emojis are supposed to be unicode.

The emojis were ❎

AmirTugi commented 5 years ago

Hi! That sounds weird. Like it should've indeed worked out of the box. Can you take a look at #12 and tell me if at helped you?

radiumrasheed commented 5 years ago

@AmirTugi at what point do I call...

page.setContent instead of page.goto('data:text/html'...

module.exports = async(data, file_path) => {
  const styleOptions = {
    // Get relative path from cwd to the desired file
    file: path.resolve(__dirname, 'style.scss')
  };

  // Get relative path from cwd to the desired file
  const htmlTemplatePath = path.resolve(__dirname, file_path);

  const pdfOptions = {
    format: 'A4',
    printBackground: true
  };

  const teaSchoolOptions = {
    styleOptions,
    htmlTemplatePath,
    htmlTemplateOptions: data,
    pdfOptions
  };

  // We just wait for the pdf to generate, and then the program can exit
  return TeaSchool.generatePdf(teaSchoolOptions);
};
oneEyedSunday commented 5 years ago

12 proved helpful thanks.