我正在尝试在Android上创建多页PDF文件。
以下是导致问题的代码部分:
document.finishPage(page);
// new page
pageNumber++;
page = document.startPage(pageNumber-1);
Canvas canvas = page.getCanvas();
// draw new page
如果我删除这段代码,一切正常,但是我的PDF文档的所有内容都在一页上。我使用的是Nexus 7。Android SDK版本为19(Android版本4.4.4)。 以下是我随机出现的错误信息:
03-24 09:09:52.183 177-177/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
...
03-24 09:09:52.283 177-177/? I/DEBUG﹕ backtrace:
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #00 pc 00077226 /system/lib/libandroid_runtime.so
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #01 pc 0007738f /system/lib/libandroid_runtime.so
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #02 pc 0001dbcc /system/lib/libdvm.so (dvmPlatformInvoke+112)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #03 pc 0004e123 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #04 pc 00026fe0 /system/lib/libdvm.so
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #05 pc 0002dfa0 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #06 pc 0002b638 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #07 pc 0006057d /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #08 pc 000605a1 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #09 pc 00055287 /system/lib/libdvm.so
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #10 pc 0000d170 /system/lib/libc.so (__thread_entry+72)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ #11 pc 0000d308 /system/lib/libc.so (pthread_create+240)
03-24 09:09:52.283 177-177/? I/DEBUG﹕ stack:
我使用ndk-stack检查了这些行,但是我没有看到任何有用的信息:
********** Crash dump: **********
Build fingerprint: 'google/razor/flo:4.4.4/KTU84P/1227136:user/release-keys'
pid: 28425, tid: 28466, name: pool-1-thread-2
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 000000e8
Stack frame #00 pc 00077226 /system/lib/libandroid_runtime.so: Routine ??
??:0
Stack frame #01 pc 0007738f /system/lib/libandroid_runtime.so: Routine ??
??:0
Stack frame #02 pc 0001dbcc /system/lib/libdvm.so (dvmPlatformInvoke+112): Routine ??
??:0
Stack frame #03 pc 0004e123 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398): Routine ??
??:0
Stack frame #04 pc 00026fe0 /system/lib/libdvm.so: Routine ??
??:0
Stack frame #05 pc 0002dfa0 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76): Routine ??
??:0
Stack frame #06 pc 0002b638 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184): Routine ??
??:0
Stack frame #07 pc 0006057d /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336): Routine ??
??:0
Stack frame #08 pc 000605a1 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20): Routine ??
??:0
Stack frame #09 pc 00055287 /system/lib/libdvm.so: Routine ??
??:0
Stack frame #10 pc 0000d170 /system/lib/libc.so (__thread_entry+72): Routine ??
??:0
Stack frame #11 pc 0000d308 /system/lib/libc.so (pthread_create+240): Routine ??
??:0
我尝试创建一个空白的白色页面文档。但是遇到了同样的问题。
你有什么想法吗?