Summary of issue:
→ App is getting freeze when opening large size of .txt file
Steps to reproduce it:
→ When we are trying open large text file, App is getting freeze. We have got some 56 MB text file. We have figured that same size of PDF is opening but for “.txt” file we are getting this issue.
How can we open this type of file. Or is their any way we can get some delegate/validation if given file will be open in PDFtron or not?
Link to a minimal sample where the issue is reproducible: LargeTextFile.zip (161.3 KB)
→ [Here I am uploading zip file as we can’t upload more than 4 MB here, Please unzip it and try to load that .txt file]
Could you please clarify which API you are using to convert text files to PDF? Looking at our default viewer document opening API, it seems we are internally using an outdated way to convert it. We can update this so that the conversion is “streamed”, that is you can see pages added to the document as they are converted, which will produce a far better experience. And of course, the app should never freeze.
I will update this thread when we have a new build available, which I expect will be tomorrow.
Thanks for the new build. In this new build, now app is not freezing but text file is still not opening immediately.
In android we noticed that it is opening in few seconds but for iOS it is still not opening and memory is increasing drastically.
We are using this method to open the file:
documentController.openDocument(with: fileURL)
Here I am attaching short video for your reference:
I’m glad the UI is responsive now. The time taken to see the first page is normal, where the exact time is dependent on system specifics. That said, we think we can optimize this, and will look into doing so. (You may notice that you can see the first page of a .docx file very quickly, and we should be able to treat text files in a similar way.) I will let you know when we have another build to try, but it will take a bit more time to prepare than the last one.
Also, I noticed in your video that an “Opening PDF…” label got stuck. I haven’t been able to reproduce that issue, but made code changes which should prevent it from happening. Builds that contain the fix start on Feb 24th.
Please let me know if you have any questions or comments on the above.
That opening PDF label is still there in latest experimental build.
Also when we try to open document, memory is also increasing too much. It is going upto 1 GB. For document showing we are using openDocument(with: fileURL) function.
(Following up on this ticket as it has been awhile)
If you are still experiencing the issue with large text files, please open a Support Ticket with our Technical Support team, here: https://www.pdftron.com/form/request/
We will be better able to assist you there. Thank you.