Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF

TOPIC:

Display Bitmap and Drawable contents on the pages 8 years 6 months ago #9664

  • jorisk
  • jorisk's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 0
Multimedia annotations is exactly what I need, but I don't get how AddAnnotBitmap is working.

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

Last edit: by jorisk.

Display Bitmap and Drawable contents on the pages 8 years 6 months ago #9667

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
please check this : www.radaeepdf.com/documentation/javadocs....html#AddAnnotBitmap(Bitmap, boolean, float[])

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

Display Bitmap and Drawable contents on the pages 8 years 6 months ago #9675

  • jorisk
  • jorisk's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 0
Thank you Davide but I already used this method according to the PDFSetStamp() method but it doesn't display the bitmap, only the rect zone.

In PDFReader.java, in a custom function:
     if (bitmap != null) {
            int len = m_rect.length;
            PDFVPageSet pset = new PDFVPageSet(len);
            PDFPos pos = m_view.vGetPos((int) m_rect[0], (int) m_rect[1]);
            PDFVPage vpage = m_view.vGetPage(pos.pageno);
            Matrix mat = new Matrix(m_rect[0], m_rect[1], m_rect[2], m_rect[3]);
            mat.TransformRect(m_rect);
            m_page.AddAnnotBitmap(bitmap, true, m_rect);
            mat.Destroy();
            pset.Insert(vpage);
            if(m_listener!=null) {
                m_listener.OnPageModified(vpage.GetPageNo());
            }
            m_status=STA_NORMAL;
            m_rects=null;
     }
In PDFReaderAct.java, in the OnPageChanged(int pageno) method:
            invalidate();
            m_view.vRenderAsync(m_vpage);

EDIT

I get the Bitmap to be displayed, but I now need it to be on a specific position and it has to follow the page when we scroll to the next/previous page. Any idea? Here is my code updated.

if (bitmap != null) {
            int len = m_rect.length;
            PDFVPageSet pset = new PDFVPageSet(len);
            PDFVPage vpage = m_view.vGetPage(pageno);
            Matrix mat = vpage.CreateInvertMatrix(m_view.vGetX(), m_view.vGetY());
            mat.TransformRect(m_rect);
            m_page.AddAnnotBitmap(bitmap, true, m_rect);
            mat.Destroy();
            pset.Insert(vpage);
            if(m_listener!=null) {
                m_listener.OnPageModified(vpage.GetPageNo());
            }
            m_status=STA_NORMAL;
            m_rects=null;
     }

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

Last edit: by jorisk.

Display Bitmap and Drawable contents on the pages 8 years 6 months ago #9681

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
can you please better explain your needs?

It seems that you are trying to simulate a sort of "FloatingButton" with addAnnot, isn't it?

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

Display Bitmap and Drawable contents on the pages 8 years 6 months ago #9682

  • jorisk
  • jorisk's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 0
Hi Davide,

I would like to produce the same behaviour that I have with the method AddAnnotURI, which works perfectly: when you add an annotation URI to coordinates, they are drawn on the page, so when you change the page, the annotation URI stays on it.

When you try this with AddAnnotBitmap, the bitmap is drawn but it is not moving when you change the page.

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

Display Bitmap and Drawable contents on the pages 8 years 6 months ago #9683

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
all the annots are related to the page, so if you want to display the same annot in all the pages, you simply have to recall AddAnnotBitmap in each page.

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

Powered by Kunena Forum