flutter_pdf_render icon indicating copy to clipboard operation
flutter_pdf_render copied to clipboard

Can't read asset file with Japanese name

Open thao-vu-0106 opened this issue 1 year ago • 4 comments

I try to read file 初めから始める数学Ⅰ新課程.pdf in assets folder, but I can't read that file. But when I change name to Latin character, it works fine.

thao-vu-0106 avatar Apr 18 '23 03:04 thao-vu-0106

On which platform do you encounter the issue?

espresso3389 avatar Apr 18 '23 15:04 espresso3389

On which platform do you encounter the issue?

My test device is Sony 702SO Android 9, I test another android device, it has same issue.

thao-vu-0106 avatar Apr 19 '23 03:04 thao-vu-0106

OK, so, on which OS, which language, and which develop environment do you develop?

espresso3389 avatar Apr 19 '23 15:04 espresso3389

I really sorry that I didn't give you clearly information:

  • I try to create grid view page with pdf file. The code below not show any page when have Japanese in name of pdf file.
  • I use English in my Mac mini 2018 and Vietnamese language in my phone.
  • source code:
import 'package:flutter/material.dart';
import 'package:flutter_pdf_reader/app.dart';
import 'package:flutter_pdf_reader/config/router/routers/home_router.dart';
import 'package:flutter_pdf_reader/presentation/widgets/common_app_bar.dart';
import 'package:flutter_pdf_reader/presentation/widgets/common_text_styles.dart';
import 'package:pdf_render/pdf_render_widgets.dart';

class PdfListView extends StatefulWidget {
  const PdfListView({Key? key}) : super(key: key);

  @override
  State<PdfListView> createState() => _PdfListViewState();
}

class _PdfListViewState extends State<PdfListView> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CommonAppBar(
        title: "Grid Pdf",
        leading: BackButton(
          color: Colors.black,
        ),
        titleTextStyle: CommonTextStyles.mediumBold,
      ),
      body: Center(
        child: PdfDocumentLoader.openAsset(
          'assets/pdf/初めから始める数学Ⅰ新課程.pdf',
          documentBuilder: (context, pdfDocument, pageCount) => LayoutBuilder(
              builder: (context, constraints) => GridView.builder(
                    itemCount: pageCount,
                    itemBuilder: (context, index) => GestureDetector(
                      onTap: () {
                        HomeRouter.goBackWithParams(context, index);
                      },
                      child: Container(
                          margin: EdgeInsets.all(8),
                          padding: EdgeInsets.all(8),
                          color: Colors.black12,
                          child: PdfPageView(
                            pdfDocument: pdfDocument,
                            pageNumber: index + 1,
                          )),
                    ),
                    gridDelegate:
                        const SliverGridDelegateWithFixedCrossAxisCount(
                            crossAxisCount: 2, childAspectRatio: 3 / 4),
                  )),
        ),
      ),
    );
  }
}

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.11, on macOS 13.2.1 22D68 darwin-x64, locale en-VN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

thao-vu-0106 avatar Apr 20 '23 04:04 thao-vu-0106