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

Russian text Rendering issue. #1658

Open
5 tasks
Hikmatullohprogramist opened this issue May 7, 2024 · 0 comments
Open
5 tasks

Russian text Rendering issue. #1658

Hikmatullohprogramist opened this issue May 7, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@Hikmatullohprogramist
Copy link

Hikmatullohprogramist commented May 7, 2024

Describe the bug

To Reproduce
Code snippet to reproduce the behavior:

// ignore_for_file: deprecated_member_use

import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart' as pr;

import '../../../../../models/basket/basket_model.dart';

Future<Future<bool>> printSalesCheck(
  BuildContext context,
  List<BasketModel> productList,
) async {
  return pr.Printing.layoutPdf(
    onLayout: (format) => _generateSalesCheckPdf(format, productList),
  );
}

Future<Uint8List> _generateSalesCheckPdf(
  PdfPageFormat format,
  List<BasketModel> productList,
) async {
  final pdf = pw.Document();

  pdf.addPage(
    pw.Page(
      build: (pw.Context context) {
        return pw.Container(
          width: double.infinity,
          child: pw.Column(
            crossAxisAlignment: pw.CrossAxisAlignment.start,
            children: [
              pw.Text(
                'Nakladnoy',
                style: pw.TextStyle(
                  fontSize: 24,
                  fontWeight: pw.FontWeight.bold,
                ),
              ),
              pw.SizedBox(height: 20),
              pw.Table.fromTextArray(
                headerStyle: pw.TextStyle(
                  fontWeight: pw.FontWeight.bold,
                ),
                data: productList.map((sale) {
                  return [
                    sale.store.name,
                    sale.quantity.toString(),
                    (sale.basketPrice[0].agreedPrice.toString()),
                    (NumberFormat("##,###", "uz_UZ").format(
                        double.parse(sale.basketPrice[0].agreedPrice) *
                            double.tryParse(sale.quantity)!)),
                  ];
                }).toList(),
                border: pw.TableBorder.all(),
              ),
              pw.SizedBox(height: 20),
              pw.Text("""

ВНИМАНИЕ!
После передачи товара продавцом покупателю, в дальнейшем ответственность за товар ПОЛНОСТЬЮ несет ПОКУПАТЕЛЬ. Возврат товара допускается, при отсутствии следов повреждений и порчи товара!
При возврате товара просим учитовать оставшиеся время до истичения сроков годгности товара!
Продукция "SOBSAN, MASTER, CHROME, UNUKA, TYTAN, POLIFIX и ARTELIT" принимаются на следующих условиях:
До истичения срока годности осталось :
3 месяца -10% от стоимости товара;
2 месяца - 20% от стоимости товара;
1 месяц - 30 % от стоимости товара;




Просроченные товры:
"TYTAN, POLIFIX и ARTELIT" - не принимаются
"SOBSAN, MASTER, CHROME, UNUKA" -40 % от стоимости товара

""")
            ],
          ),
        );
      },
    ),
  );

  return pdf.save();
}
![image](https://github.com/DavBfr/dart_pdf/assets/96409206/15b5c5b1-b3c0-463d-beac-0b3043ba432c)

Expected behavior

Screenshots

Flutter Doctor

Desktop (please complete the following information):

  • iOS
  • Android
  • Browser
  • Windows
  • Linux

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

@Hikmatullohprogramist Hikmatullohprogramist added bug Something isn't working needs triage labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant