Skip to content

.ttf fonts not working with compressed pdf on Safari browser. #2955

@cbermudezroda

Description

@cbermudezroda

Hey everyone!
I'm using the librery for a Angular proyect and it's works fantastic. However, I'm having a weird problem when I try to use embedded fonts and compressed pfd on Safari (only here). The result is a pdf with strange caracters :(
The strange thing is that if the pdf is not compressed, it's works good!

Here some stuffs to get context:

  • Installed jsPDF by npm
  • Angular 8
  • Code use:
import jsPDF from 'jspdf';
import RobotoRegularFont from '../../../assets/fonts/Roboto/Roboto-Regular.ttf';
... // other code 
generateAndDownloadPDF() {
   const doc = new jsPDF('p', 'mm', 'a4', true);
   doc.addFont(RobotoRegularFont, 'Roboto', 'normal');
   // other code
   doc.setFont('Roboto');
   // other code
  doc.save('export.pdf');
}

Before using this code I tryed with the exaple on the README.md but had the same problem.
The fonts works for all browsers and differents SO in compress mode except Safari.
Any thought what can be happening?

Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions