Dealing with pdf files - flutter

I am implementing an application which its main idea is reading books using it.
the pdf files are on my server and I want the user to read the book without saving it on their device.
I thought about streaming the pdf file or embedding it. but it has some difficulties.
So, what is the best solution for this issue?
I am using Django-Rest-framework and Flutter

i think you have to use list of this packages for reading pdf files into flutter.
https://pub.dev/packages/syncfusion_flutter_pdf
https://pub.dev/packages/syncfusion_flutter_pdfviewer

Related

Flutter Web how to read and write file (xlsx,txt etc)

I am trying to read the two files first one is a text file and the second one is an excel file. I'm using flutter web 2.10 but can't find a way to read those files. I have tried this method but it doesn't work now To read and Write File in Flutter Web
Currently, I am kinda stuck with it. For now, I am reading the text file as a string and then parsing it, but it is not a good way to do it. So if you have any better way to read files in flutter web please do share.
Uint8List? bytes=result.files.first.bytes;
file=File.fromRawPath(bytes!);
file.readAsLines();
returnResult=file.toString();

Display ePub Files Using Flutter

Having solely developed Android applications I have decided to try crossplatform development, so far Flutter has been a much more pleasant experience than Xamarin however, I have now run into a roadblock.
I want to give users the ability to read ePub files downloaded from my server. I came across this Flutter package but it is not clear to me how to display the ePub inside a container to the user - https://pub.dartlang.org/packages/epub
I cannot find any examples/tutorials other than the one provided on the example page (which has a Image package conflict. I fixed this conflict by changing the package import line to 'import package:image/image.dart' as image) then all references to it in the main method to image.Image. This might be another issue to resolve another day when it comes to adding custom placeholders for missing images.
I cannot share my ePub files but I have tested with the one found on the github repository here https://github.com/orthros/dart-epub/blob/dev/test/hittelOnGoldMines.epub
Thank you
The only resource that I found was https://github.com/pycampers/flutter_pdf_viewer, but for now it is just for Android.
Another aproach is to load a webview and load the pdf using some JS framework.

Failed to display UIWebView to display docx/xlsx file with SFUZipEndOfCentralDirectoryError error with custom URL

We are writing some program to display documents on iOS. I think that there are a lot of confusion on the web about what type of documents which iOS UIWebView could display. Generally people refer to Technical Q&A QA1630 Using UIWebView to display select document types to see that all the MS office 07+ files (such as docx, xlsx, pptx) could not be displayed, however actually that is not what we see from testing. Actually we are able to display docx/xlsx/pptx document at UIWebView either loading from a remote URL, local file or in memory (loadData, here the baseURL can not be nil on simulator, see this link). Of course We are testing on latest version of iOS on iPhone simulator, it might be that the support was not at older iOS. At this point, We don't know that yet. If you know, please let me know.
However right now, We have one issue to display document at UIWebView by using custom URL for security reason. I did the custom URL by following the code here: protecting iOS resource. We could display xls, doc, ppt, pdf file, but not docx/xlsx/pptx, We got some error like this:
EXCEPTION SFUZipEndOfCentralDirectoryError: Could not find the end of central directory record
We tried to debug and could not figure what's to do here. Do you see similar error here? Could anyone shed some lights on this? Thanks very much.
It looks like the document you're trying to open might be corrupt. docx, xlsx, and pptx files are actually zip files containing a bunch of XML documents and other data. Check if you are able to uncompress the file on your computer by renaming it to .zip and then unzipping.

How can I edit PDF files in an iOS application?

In my iPhone / iPad application, I show a person's medical reports in the form of a PDF. I have saved the reports in the documents directory and am reading them from there.
I want the user to be able to add or edit comments on these PDFs, as well as be able to highlight certain sections in the PDF. After editing, the application should be able to save the PDF back into the documents directory.
Is this possible within an iOS application? If so, how? Is this a task for Core Graphics?
Editing PDF directly on iPad/iPhone is a rather big job because the standard API only supports showing it (and only a bit more.) If you want to do anything more, you need to invest a huge amount of time to implement generic pdf handling code.
There is an open-source library handling these, e.g. this one. I don't know if it fits your needs, though.
A better idea, in my opinion, is to create a native UI showing the data contained in the PDF file using the standard Cocoa-Touch UIKit and create the PDF once the user is done with it so that the user can export it back. That way, you don't have to write a complicated PDF handling code.
In any case, it's not a good idea to show generic PDF on iPhone, because the screen size is so small (iPad is a different question, especially if you expect the user to be familiar with the particular format of your pdf.). A dedicated UI would be much better.

Parse .ics data in iPhone project

I am making an iPhone application and i want to use libical to parse .ics dat from an .ics file OR from the URL location of the .ics file..
Firstly i want to know how i would go about using libical in my project? How to add it into my iphone project etc.. ive seen some guides but they seem to be specific to OSX projects and not iphone projects..
Secondly i want to parse event names and their descriptions, so i that i can store the event names/ descriptions as variables..
I was wondering if this was possible using libical.. if so could someone please show me roughly how i may go about implementing this...
Any and all information will be very much appreciated!
Thank You For Reading
I know it might not be a very helpful answer - posting it because i can't comment on the question, so sorry for that - but ics data files are relatively easily parsable. Open one in a text editor and take a look, i've implemented an ics parser before for exactly what you're trying to do, took me a couple of hours, and trying to get all sorts of libraries to compile used taken me more in a few occasions :)
Found an excellent library for parsing .ics files. There are a whole lot of functions too for other tasks like managing calendar and calendar events.
https://github.com/KiranPanesar/MXLCalendarManager