-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
PDFViewer on Android crashes for large files #125
Comments
Did you test the same PDF with the demo (i.e. instead of it using Feature Matrix.pdf)? I just tested a 914 page file, and it loads the first 500 pages (I stopped scrolling after that) without crashing. If the demo crashes, are you able to provide a PDF file to test with? |
Thank you very much for testing. With the original demo the error does not occur so it must have to do with the modifications I made. However, since I only added the support to zoom into the pdf, which is not in action while scrolling, I currently do not understand which side effect might be responsible for the crash. Sorry for bothering. |
I had planned to add zooming, however I am yet to do that. I'll keep this issue open as a reminder :-) |
Great, looking forward see how you will implement it. |
Now I can reproduce the crash for your demo app with just one modification. I call TPDFRenderer.RenderPage with AScale = 5.0 which I originally did in order to have a high resolution bitmap for zooming in. With this single change your demo crashes as reported above. |
Thanks for the update! I'll look into it |
Still cannot get it to crash. Please show exactly what you are changing, and it may also help if I know which PDF file you are using |
This is the change I made (the last argument of FRenderer.RenderPage is set to 5.0, overwriting the default 1.0 procedure TPDFControl.LoadPage; The crash happens on Android 64 phones (I am not aware if it can be observed in any simulator). I can't share the PDF I am using publically, if you provide any means for a personal communication I will send it to you. |
It was my bad.. I tested with scale of 0.5 instead of 5.0! I've removed the scaling of the native bitmap (not sure why I did it that way!). I suspect the scaling should be done in the bitmap in the image in the control instead. Could you help work out how to do that? |
If I remember correctly my experiments, without scaling the native bitmap (giving it a higher resolution than 1), the bitmap in the control will have a resolution which is not good enough for zooming in, too. Then it would be necessary to somehow link a page in the control to the corresponding page of the pdf such that one could rerender the bitmap with the needed resolution while zooming. A workaround could be to use a high scale (say 5) on creation of the bitmap, but to keep only a subset of the pages within the control. This would save the memoty for many hight resolution bitmaps (which is what I assume the reason for crashing). However, so far I did not find the time to implement something like that myself. |
I am using your PDFViewer as shown in your demo application. When loading a huge file (say 1000 pages) and scrolling through the file, the app eventually crashes (typically when reaching some point beyond page 100). No exception is thrown, even the debugger gets no notice of the problem.
Any idea how to fix this issue?
The text was updated successfully, but these errors were encountered: