6

i have a project to print out the working report. i got trouble when putting check mark inside pdfmake generated report i follow some instructions from below link :

i already follow all the instructions there but my fontelo nor fontawesome icon show up in my report. while using fontawesome. the icon show square block no the real icon. hope someone can help me figure this out thanks

Daniel Kreiseder
  • 12,135
  • 9
  • 38
  • 59
Jsnow
  • 375
  • 1
  • 6
  • 14

4 Answers4

5

Maybe you could include some code (a minimal docDefinition, and the printer part).

My code, using fontawesome to display checkboxes/radio icons :

The printer part :

var fonts = {
    Roboto: {
        normal: 'assets/fonts/Roboto-Regular.ttf',
        bold: 'assets/fonts/Roboto-Medium.ttf',
        italics: 'assets/fonts/Roboto-Italic.ttf',
        bolditalics: 'assets/fonts/Roboto-MediumItalic.ttf'
    },
    FontAwesome: {
        normal: 'assets/fonts/fontawesome-webfont.ttf'
    }
  };
// ...
var printer = new PdfPrinter(fonts);

And the docDefinition. You can try using the unicode code :

var dd = {
  content: { text: "\uf046   ", style: 'fontawesome' },
  styles: {
    fontawesome: {
      'font': 'FontAwesome',
      'color': "#656565"
    }
  }
}
arnaud del.
  • 904
  • 12
  • 27
5

Maybe this ASCII value could work for you? √√√√√√√√

  • Mac: Option + v
  • Windows10: Alt + 251

You will get this symbol √ which is similar to the tick checkmark.

{
   text: '√',
   absolutePosition: { x: 21, y: 293 }
}

Happy Coding! :)

Mr. Dang
  • 535
  • 8
  • 14
3

you can use canvas to draw the square for checkmark as below

canvas: [
            {
                type: 'polyline',
                lineWidth: 1,
                closePath: true,
                points: [{ x: 0, y: 0}, { x: 8, y: 0 }, { x: 8, y: 8 }, { x: 0, y:8 }]
            }
        ]

and then use it with column to make it look like checkbox

Ramesh Maharjan
  • 41,071
  • 6
  • 69
  • 97
0

You could also use a image next to a text like I did here.

https://stackblitz.com/edit/angular-pdfmake-example-3f14km?file=src%2Fapp%2Fapp.component.ts

J.C
  • 632
  • 1
  • 10
  • 41