Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Development and suggestions about third part tool integration.
Cordova, Xamarin, Basic4Android topics are listed here.
  • Page:
  • 1
  • 2

TOPIC:

Retrieve Acrofield Status 5 years 11 months ago #13785

  • mfranc28
  • mfranc28's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
I'd like to know how I can get the modded acrofield from my PDF.
With my previous library I retrieve an Hastable of this field.

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

Retrieve Acrofield Status 5 years 11 months ago #13787

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
We are not sure that we understand your request, probably this is not supported.

But if you can send us an example pdf (better with the expected result), we can give you a more definitive answer.

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

Retrieve Acrofield Status 5 years 11 months ago #13788

  • mfranc28
  • mfranc28's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
I try the Doc.Save of a Offline document but without result. The PDF next time I open it it be blank, without my update.

I found also how I can take all modded acrofield with this code:
for (int i = 0; i < rPdfDoc.PageCount; i++)
{
Com.Radaee.Pdf.Page page = rPdfDoc.GetPage(i);
page.ObjsStart();
for (int j = 0; j < page.AnnotCount; j++)
{
Annotation annot = page.GetAnnot(j);
annot.ReadOnly = true;
}
page.Close();
}

But I can't understand if this give me only the modded acrofield or all acrofield.

Finally in attach there is my test PDF. I want to open PDF, modify some field and checkbox, the sign and save all my work. Next time I open this PDF must have all my previous update, at the moment no problem with the sign, my problem is with the acrofield.

Thanks
Attachments:

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

Retrieve Acrofield Status 5 years 11 months ago #13791

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
If you are opening the pdf from stream, Document.Save will save the modification to the byte array. So you will need to re-write the byte array into the file system (check the below code)
The above code will get all types of annotations, you will need to filter them based on type, maybe also field name.. use something like the following:
Document document = new Document();
            PDFMemStream memStream = new PDFMemStream(File.ReadAllBytes(path));
            if(document.OpenStream(memStream, "") == 0)
            {
                for(int i = 0; i < document.PageCount; i++)
                {
                    Page page = document.GetPage(i);
                    page.ObjsStart();
                    for (int j = 0; j < page.AnnotCount; j++)
                    {
                        Page.Annotation annot = page.GetAnnot(j);
                        if (annot.EditType > 0 && annot.FieldName.Equals("Text3"))
                        { //edit form 
                            annot.SetEditText("New string");
                        } else if(annot.CheckStatus >= 0)
                        { //cehck box

                        } else if (annot.ComboItemCount >= 0)
                        { //combo box

                        }
                    }
                    page.Close();
                }
            }
            document.Save();
            document.Close();
            File.WriteAllBytes(path, memStream.Get_data());
You can also check www.radaeepdf.com/documentation/javadocs...ation.html#GetType--

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

Retrieve Acrofield Status 5 years 11 months ago #13822

  • mfranc28
  • mfranc28's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
I don't understand why it doesn't work.
My code Is attached.

Note: variable memStream is my current opened pdf in viewer

Please can you help me understand where I did a mistake?
Attachments:

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

Retrieve Acrofield Status 5 years 11 months ago #13823

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
We've checked your code, but couldn't test it as it's not complete.

It seems ok, make sure to activate the premium license before invoking this code, and that all the set methods returns true.
Also the document.Save returns true.

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

  • Page:
  • 1
  • 2
Powered by Kunena Forum