Locking annotation added to PDF documents - 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...
Tell us about your applications and your projects.
  • Page:
  • 1

TOPIC: Locking annotation added to PDF documents

Locking annotation added to PDF documents 7 months 1 week ago #13780

  • nermeen
  • nermeen's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
1. It mostly depends on your implementation flow, but the idea is to set
annot.ReadOnly = true;
when you want (after annotation creation for example).

Then check the readonly mode before the action you want to prevent, i.e. to prevent moving you can modify OnAnnotTouchMove, OnAnnotTouchEnd as follows:
if (m_status != PDFV_STATUS.STA_ANNOT) return false;
if (m_annot.ReadOnly)
{
    vAnnotEnd();
    return false;
}

2. We cannot understand the problem, can you please better explain?

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

Locking annotation added to PDF documents 7 months 1 week ago #13784

  • nermeen
  • nermeen's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
1. It can be immediately after the annotation creation:
page.AddAnnotTextNote()
PDFAnnot annot = page.GetAnnot(page.AnnotCount - 1);
annot.ReadOnly = true;
and/OR it can be done on the document level for all the annotations:
m_doc = new PDFDoc();
            m_doc.Open(m_stream, "");
            for(int i = 0; i < m_doc.PageCount; i++)
            {
                PDFPage page = m_doc.GetPage(i);
                page.ObjsStart();
                for(int j = 0; j < page.AnnotCount; j++)
                {
                    PDFAnnot annot = page.GetAnnot(j);
                    annot.ReadOnly = true;
                }
                page.Close();
            }
            m_doc.Save();
2. In the demo project this is handled via the annot open/perform button (first button on the left in the EditAnnotControl), check the video https://www.dropbox.com/s/e83n7c7l4zc4wu4/Note.zip?dl=0

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

Locking annotation added to PDF documents 7 months 5 days ago #13789

  • nermeen
  • nermeen's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
1. We have tested it with the demo project and no problem found, are you sure that annot.ReadOnly is false after this operation?

2. To jump the button click part, you can add the following to OnPDFAnnotClicked in PDFReaderPage:
...
                    mFormComboControl.Show();
                }
                else if (annot.IsPopup && annot.Type == 1) // add type check as it enters also for highlight annot
                {
                    //popup dialog to show text and subject.
                    //nuri is text content.
                    //subj is subject string.                   
                    OnPDFAnnotPopup(annot, annot.PopupSubject, annot.PopupText);
                    m_view.vAnnotEnd();
                    return;
                }
...

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

Locking annotation added to PDF documents 7 months 4 days ago #13797

  • nermeen
  • nermeen's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
You need to implement both the part that sets the read-only attribute and the part that checks it
//setting the all the annotation as read only
for (int i = 0; i < m_doc.PageCount; i++)
{
PDFPage page = m_doc.GetPage(i);
page.ObjsStart();
for (int j = 0; j < page.AnnotCount; j++)
{
PDFAnnot annot = page.GetAnnot(j);
annot.ReadOnly = true;
}
page.Close();
}
m_doc.Save();
And modify OnAnnotTouchMove, OnAnnotTouchEnd as follows:
if (m_status != PDFV_STATUS.STA_ANNOT) return false;
if (m_annot.ReadOnly)
{
    vAnnotEnd();
    return false;
}

You can download a sample from http://own.mobiles.it/index.php/s/LMkneRpyhCthTBc (password = Radaee)

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

Locking annotation added to PDF documents 7 months 3 days ago #13805

  • nermeen
  • nermeen's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
The demo we've sent is based on the latest stable release, so we do not think that updating these files will create an issue.
Make sure to update also the lib part (RDPDFLib bin and lib).

For the part related to the TextNote, is the part mentioned in https://www.radaeepdf.com/forum/Application-adopting-PDFViewer-SDK/4064-locking-annotation-added-to-pdf-documents?limitstart=0#13789

add the following to OnPDFAnnotClicked in PDFReaderPage.cs:
...
                    mFormComboControl.Show();
                }
                else if (annot.IsPopup && annot.Type == 1) // add type check as it enters also for highlight annot
                {
                    //popup dialog to show text and subject.
                    //nuri is text content.
                    //subj is subject string.                   
                    OnPDFAnnotPopup(annot, annot.PopupSubject, annot.PopupText);
                    m_view.vAnnotEnd();
                    return;
                }
...

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

  • Page:
  • 1
Powered by Kunena Forum