Show rectangle of annotation - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Show rectangle of annotation

Show rectangle of annotation 3 weeks 11 hours ago #13667

  • vitdos1
  • vitdos1's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 0
hello, how i can show rectangle of ink annotation on the screen programmatically (such as when i tap to annotation on the screen)?

Please Log in or Create an account to join the conversation.

Show rectangle of annotation 2 weeks 6 days ago #13670

  • Davide
  • Davide's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 778
  • Karma: 16
  • Thank you received: 61
Hi,
you have to get the annot rect and rescale it to screen size, then you have to draw it to your canvas.
m_annot_rect = m_annot.GetRect();
m_annot_page = m_layout.vGetPage(pageno);
float tmp = m_annot_rect[1];
m_annot_rect[0] = m_annot_page.GetVX(m_annot_rect[0]) - m_layout.vGetX();
m_annot_rect[1] = m_annot_page.GetVY(m_annot_rect[3]) - m_layout.vGetY();
m_annot_rect[2] = m_annot_page.GetVX(m_annot_rect[2]) - m_layout.vGetX();
m_annot_rect[3] = m_annot_page.GetVY(tmp) - m_layout.vGetY();

Paint paint = new Paint();
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(2);
paint.setARGB(0x80, 0, 0, 0);
canvas.drawRect(m_annot_rect[0], m_annot_rect[1], m_annot_rect[2], m_annot_rect[3], paint);

Code is taken from onSingleTapConfirmed in PDFLayoutView.

Please Log in or Create an account to join the conversation.

Show rectangle of annotation 2 weeks 15 hours ago #13699

  • vitdos1
  • vitdos1's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 0
thanks but i have error of native library when i try this method:
canvas.drawRect(m_annot_rect[0], m_annot_rect[1], m_annot_rect[2], m_annot_rect[3], paint);
i take canvas from PDFLayoutView.onDraw (Canvas canvas)

error:
beginning of crash
04-11 09:50:27.768 17719-17719/by.mrsoft.mrdoc A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 17719 (by.mrsoft.mrdoc)
04-11 09:50:27.807 17797-17797/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86:8.0.0/OSR1.180220.006/4662038:userdebug/dev-keys'
Revision: '0'
ABI: 'x86'
pid: 17719, tid: 17719, name: by.mrsoft.mrdoc >>> by.mrsoft.mrdoc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
Cause: null pointer dereference
eax 00000008 ebx b4137ce4 ecx 00000009 edx 93bf4880
esi 00000008 edi 00000014
xcs 00000073 xds 0000007b xes 0000007b xfs 0000003b xss 0000007b
eip b40a8814 ebp bfd0e958 esp bfd0e920 flags 00010206
04-11 09:50:27.977 17797-17797/? A/DEBUG: backtrace:
#00 pc 00051814 /system/lib/libhwui.so (_ZN7android10uirenderer15LinearAllocator9allocImplEj+36)
#01 pc 00091607 /system/lib/libhwui.so (_ZN7android10uirenderer15RecordingCanvas10drawGlyphsEPKtPKfiRK7SkPaintfffffff+103)
#02 pc 0002cc1b /system/lib/libhwui.so (_ZN7android15DrawTextFunctorclEjj+475)
#03 pc 0002c601 /system/lib/libhwui.so (_ZN7android12MinikinUtils10forFontRunINS_15DrawTextFunctorEEEvRKN7minikin6LayoutEPNS_5PaintERT_+401)
#04 pc 0002c39a /system/lib/libhwui.so (_ZN7android6Canvas8drawTextEPKtiiiffiRKNS_5PaintEPNS_8TypefaceE+426)
#05 pc 000fbf89 /system/lib/libandroid_runtime.so (_ZN7android9CanvasJNIL14drawTextStringEP7_JNIEnvP8_jobjectxP8_jstringiiffixx+137)
#06 pc 011f4371 /system/framework/x86/boot-framework.oat (offset 0x5e7000) (android.view.RecordingCanvas.nDrawText [DEDUPED]+305)
#07 pc 000e455a /dev/ashmem/dalvik-jit-code-cache (deleted)

Please Log in or Create an account to join the conversation.

Last Edit: by vitdos1.

Show rectangle of annotation 1 week 6 days ago #13701

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 789
  • Karma: 20
  • Thank you received: 58
Actually the crash is in the system's native libs (not in librdpdf.so)

And the cause is null pointer reference .. so make sure that you are initializing every parameter correctly.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum