Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #9297 Reply

    Mark

    Hello,

    I’m trying to figure out how to insert an annotation to a simple PDF ReaderView as the one described here: https://plugpdf.com/my-first-mobile-pdf-app/

    Just to put things into perspective, this is the context where I’m trying to insert my Ink annotation.

    As you see, I don’t want to insert any annotation via the PlugPDF SimpleDocumentReader, but from something much more simple: The “Hello World” example is perfect for what I want to achieve.

    Having said that, I’m using

    However I’m not sure about that. Should I use setAnnotationTool (AnnotToolType tool) for inserting annotations through ReaderView objects?

    Here it is what my Android Studio log looks like: http://pastebin.com/NvYA4Zd6

    Please, could you provide a simple code snippet for inserting an AnnotInk to my mReader object?

    Thank you for your help.

    Cheers,

    #9312 Reply

    Mark

    Hello,

    How about accessing ReaderView‘s PDFDocument object?

    For example:

    This way I can run PDFDocument‘s insertInkAnnot method.

    However, how could I get the array of points required for insertInkAnnot to operate?

    Should I implement myself a drawing method as the one attached here?

    http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger

    http://stackoverflow.com/questions/16650419/draw-in-canvas-by-finger-android

    Please, let me know your thoughts about this idea.

    Once again, thank you for your help.

    Cheers,

    #9336 Reply

    Dr. Plug
    Moderator

    Hi Mark,

    Thank you for your interest in PlugPDF. Actually you can insert ink annotation by manually like below code.

    If you use above code, you can see the 2 lines in the your pdf.

    Thank you,
    Dr. Plug

    #9337 Reply

    Mark

    Hi Dr. Plug,

    I understand your view, thank you!, that’s what I had deduced.

    But how can I link the points array with the user interaction, when drawing a line with their fingers on the device screen? Does the PlugPDF provide a way to first “listen” the screen and then take the points array?

    Or put another way, should I program myself the listener method as described here?

    http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger

    Cheers,

    #9342 Reply

    Dr. Plug
    Moderator

    Hi Mark,

    Do you want draw ink via listen gesture? Then, you can it by ‘setAnnotationTool’ method such as below,

    It can listen to user’s gesture and draw ink.

    And after drawing, you should change the GestureType again to ‘GestureType.VIEW’.

    Thank you,
    Dr. Plug

    • This reply was modified 1 year, 5 months ago by  Dr. Plug.
    #9352 Reply

    Mark

    Hello Dr. Plug,

    That’s exactly what I needed!

    GestureType is an enumeration available in BaseGestureProcessor. I was trying to find this answer by looking at SimpleDocumentReader‘s source code.

    Now I understand how the annotations work.

    Thank you.

    #9361 Reply

    Mark

    Hi Dr. Plug,

    Is it possible to customize the drawing line’s features (color, width, type, etc.)?

    Thank you.

    #9362 Reply

    Mark

    Hello again,

    There’s something I don’t understand right now.

    How is it that mReader can be accessed this way

    in order to set the current annotation tool, but on the other hand it hasn’t any method for customizing it?

    In this example, is it possible to customize the ink annotation tool via mReader?

    Thank you,

    #9400 Reply

    Dr. Plug
    Moderator

    Hi Mark,

    Thank you for your inquiry. Actually you can change color, and width but not type. like below.

    Thank you,
    Dr. Plug

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: An example for inserting an Ink annotation into a ReaderView object
Your information: