451518849 / epub_kitty

a beautiful flutter epub reader!
https://pub.dev/packages/epub_kitty
Other
66 stars 30 forks source link

container.xml couldn't be opened #11

Open kebsont opened 4 years ago

kebsont commented 4 years ago

Hello, thanks for this plugin. My problem is I can't open any epub file with it. I download it in the device, You can see here its path ( _/Users/kebson/Library/Developer/CoreSimulator/Devices/24B449AE-9DA8-406B-BBDA-F9847D44211D/data/Containers/Data/Application/A53AE134-67FE-4630-9C4E-7C8F2D95D3F1/Documents/EpubFormat.pdf)

But when I try to open it, I got this error:

Screenshot 2020-03-21 at 21 49 35

I tried with different epub. But I always got the same error.

451518849 commented 4 years ago

it can not read pdf! please, replace pdf file with epub.

kebsont commented 4 years ago

Yes, It was an error from me. But I tried epub with, and got the same error. Here is the file: /Users/kebson/Library/Developer/CoreSimulator/Devices/24B449AE-9DA8-406B-BBDA-F9847D44211D/data/Containers/Data/Application/3111CC1B-3CDA-4F75-836C-673A1A4FD363/Documents/Epub_Format.epub

What I did is I took an epub url and download it locally, and tried to open it from the getApplicationDocumentsDirectory().

451518849 commented 4 years ago

you can try epub file in example to confirm your epub file content is correct.

kebsont commented 4 years ago

Yeah I've tried with that one too . I even cloned that repo to try for seeing if it's my epub which is corrupted but got the same error.

451518849 commented 4 years ago

confused! can you show your code, let me see it.

kebsont commented 4 years ago
child: Container(
                      height: mediaQuery.size.height - 30,
                      child: itemProvider.downloaded
                          ? GestureDetector(
                              onTap: () async {
                                itemProvider.getDownload().then((v) {
                                  if (v.isNotEmpty) {
                                    ItemModel dl = v[0];
                                    String itemPath = dl.fileUrl;
                                    EpubKitty.setConfig(
                                        "iosBook", "#32a852", "vertical", true);
                                    EpubKitty.open(itemPath);
                                    pageChannel.receiveBroadcastStream().listen((Object event) {
                                        print('page:$event');
                                      }, onError: null);

                                  }
                                });
                              },
                              child: ClipRRect(
                                borderRadius: BorderRadius.circular(24.0),
                                child: CachedNetworkImage(
                                  imageUrl:
                                      "imgUrlHere",
                                  placeholder: (context, img) => Center(
                                      child: CircularProgressIndicator()),
                                  errorWidget: (context, img, error) =>
                                      Image.asset(
                                    "assets/images/Diawartou.png",
                                    width: mediaQuery.size.width / 2,
                                    height: (mediaQuery.size.height - 2),
                                  ),
                                ),
                              ))
451518849 commented 4 years ago

It seems no problem. then print the 'itemPath' and show it .

kebsont commented 4 years ago

/Users/kebson/Library/Developer/CoreSimulator/Devices/24B449AE-9DA8-406B-BBDA-F9847D44211D/data/Containers/Data/Application/3111CC1B-3CDA-4F75-836C-673A1A4FD363/Documents/Epub_Format.epub

451518849 commented 4 years ago

The path is also no problem. I suggest you to try in local first. Copy the Epub_Format.epub into Application/3111CC1B-3CDA-4F75-836C-673A1A4FD363/Library/Caches, and use following code to get path Directory appDocDir = await getTemporaryDirectory(); then try open it.

451518849 commented 4 years ago

If you can not open your epub , copy example/ios/3.epub to local cache with the same way above.

kebsont commented 4 years ago

The same, it's not relative to the path or the file itself. I've changed the directory to use this one /Users/kebson/Library/Developer/CoreSimulator/Devices/24B449AE-9DA8-406B-BBDA-F9847D44211D/data/Containers/Data/Application/1DDE1F0A-954F-4B6A-BC6B-335F582B7ABD/Library/Caches/Epub_Format.epub and it doesn't work, same for the file

451518849 commented 4 years ago

Ok,I will check it, give me a little time.

kebsont commented 4 years ago

Okay thanks. I'm waiting for ...

451518849 commented 4 years ago

You use the example or plugin 0.1.5?

kebsont commented 4 years ago

Yes I do.

451518849 commented 4 years ago

You can try 0.1.0.

kebsont commented 4 years ago

Ok

kebsont commented 4 years ago

I got the same error

451518849 commented 4 years ago

I found an error on 0.1.5 but not yours.

kebsont commented 4 years ago

what is it ? not related with mine ?

451518849 commented 4 years ago

Yeah, I found the page not show correctly and will cause a collapse, however, it can read book.

kebsont commented 4 years ago

for me I can't even open the first page

451518849 commented 4 years ago

I think it's either the wrong path or the file.

kebsont commented 4 years ago

No, I'm sure it's not any of them. Because the file I can open it with an epub reader, I even use anothers epub file to test and the path I changed it twice.