Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

euro symbol issue #30

Closed
Icosa2050 opened this issue Jan 29, 2019 · 6 comments
Closed

euro symbol issue #30

Icosa2050 opened this issue Jan 29, 2019 · 6 comments

Comments

@Icosa2050
Copy link

Thanks for your fine library, it is unique and helps a lot. Sadly I am not good enough to help the lib or even help myself, understanding that PDF encoding is very complicated, therefore I open this issue.
I want to print values with currency symbol, dollar and pound do work, no surprise somehow, but euro symbol drives me nuts.
I tested with Unicode branch and different fonts, loaded TTF fonts. I checked the euro symbol is where it should be in the fonts. Symbol Unicode | ₠
The character printed looks like a small < sign, no matter my fonts (arial, sans, mono, courier) . I am on a ubuntu 18.10.
Any ideas for a workaround for this kind of edge cases, somehow printing out symbols hard coded or in any other way, would be highly appreciated.

@DavBfr
Copy link
Owner

DavBfr commented Jan 29, 2019

Hi,
Don't try Unicode, it is not working at all.
To print Euro sign, use String.fromCharCode(128), using the basic Helvetica embedded font, it works.

@Icosa2050
Copy link
Author

Thank you very much for your quick and helpful answer. It does print the symbol. Great so far. Now I will have to tinker around , to replace the symbol in user textfields and from db with the Result of String. fromCharCode(128) expression.

@erperejildo
Copy link

Hi,
Don't try Unicode, it is not working at all.
To print Euro sign, use String.fromCharCode(128), using the basic Helvetica embedded font, it works.

Any reason why this doesn't work? I use a different package that returns a money format based on my language so the only thing I get is the symbol pls the ammount

@DavBfr
Copy link
Owner

DavBfr commented Dec 22, 2020

@erperejildo That's an old issue, it's perfectly working now:

 Future<Uint8List> _generatePdf(PdfPageFormat format, String title) async {
    final pdf = pw.Document();

    final fontData = await rootBundle.load('assets/open-sans.ttf');
    final font = pw.Font.ttf(fontData);

    pdf.addPage(
      pw.Page(
        pageFormat: format,
        build: (context) => pw.Text('Hello €', style: pw.TextStyle(font: font)),
      ),
    );

    return pdf.save();
  }

@SilkeNL
Copy link

SilkeNL commented Apr 21, 2021

I might be doing something else wrong but I do still have the error on the €-sign.

String.fromCharCode(128) Worked fine

pw.Row( mainAxisAlignment: pw.MainAxisAlignment.end, children: [ pw.Text('Total price: €539.00', style: pw.TextStyle(fontSize: 16)), ]),

@FallasB
Copy link

FallasB commented Sep 17, 2022

Same as @SilkeNL, with latest version 3.8.3 on flutter web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants