我在我的应用程序中强制关闭,当我选择 file1(大小:33,016,510 - 不确定是字节还是 kb)但当我尝试 file2(大小:604,612)时,它不会强制关闭。iTextPDF 可以读取多少文件?
文件1:400-500页,有图像背景和图像,但文本都是HIGHLIGHTABLE,因此可以读取文本(这是我确定PDF内容是文本还是图像的方法,如果我错了,请纠正我)。
文件2:30-50页,有图片,没有背景。
我有想法为什么它会强制关闭。
- 由于PDF文件大小。
- 代码它自己。
- PDF 的内容。
我用来阅读PDF的代码:
page_Content = PdfTextExtractor.getTextFromPage(
reader, 0, new SimpleTextExtractionStrategy());
这里有什么问题?
如果信息不足,请在下方评论。
例外:
12-26 19:20:19.026: E/AndroidRuntime(1119): FATAL EXCEPTION: main
12-26 19:20:19.026: E/AndroidRuntime(1119): java.lang.OutOfMemoryError
12-26 19:20:19.026: E/AndroidRuntime(1119): at java.util.ArrayList.add(ArrayList.java:123)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfArray.add(PdfArray.java:269)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.readArray(PdfReader.java:1608)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.readPRObject(PdfReader.java:1657)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.readDictionary(PdfReader.java:1588)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.readPRObject(PdfReader.java:1624)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.readDocObj(PdfReader.java:1143)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.readPdf(PdfReader.java:511)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:170)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:159)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.example.panalyzerdemo.InformationRetrieval.pdfFilePath(InformationRetrieval.java:54)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.example.panalyzerdemo.MainActivity.onActivityResult(MainActivity.java:207)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.app.Activity.dispatchActivityResult(Activity.java:3890)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.app.ActivityThread.deliverResults(ActivityThread.java:3514)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3560)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.app.ActivityThread.access$2800(ActivityThread.java:128)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.os.Handler.dispatchMessage(Handler.java:99)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.os.Looper.loop(Looper.java:123)
12-26 19:20:19.026: E/AndroidRuntime(1119): at android.app.ActivityThread.main(ActivityThread.java:4644)
12-26 19:20:19.026: E/AndroidRuntime(1119): at java.lang.reflect.Method.invokeNative(Native Method)
12-26 19:20:19.026: E/AndroidRuntime(1119): at java.lang.reflect.Method.invoke(Method.java:521)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
12-26 19:20:19.026: E/AndroidRuntime(1119): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
12-26 19:20:19.026: E/AndroidRuntime(1119): at dalvik.system.NativeStart.main(Native Method)