Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Delete highlight from page

More
IP: 192.168.0.71 8 years 5 months ago - 8 years 5 months ago #12913 by vlad91
Hello,
I'm trying to delete highlights. I get a reference to the annotation using document.GetPage(pageno).GetAnnot(index) and the I call RemoveFromPage(), however this method returns false. I'm sure that the license setup is correct, selection and highlighting work as expected.
I also noticed that document.CanSave() is always false!

Can some help me please?

Kind regards,
Vlad
Last edit: 8 years 5 months ago by vlad91.
More
IP: 192.168.0.71 8 years 5 months ago #12924 by Davide
Replied by Davide on topic Delete highlight from page
Hi,
you need to call page.ObjsStart(); before m_annot.RemoveFromPage();.
For more info check this : www.radaeepdf.com/documentation/javadocs...age.html#ObjsStart--

Document.CanSave() dipends on how you open the doc, it returns false if you open it in memory for example using OpenMem, in this case is opened in read only mode and you can't even add annots..
More
IP: 192.168.0.71 8 years 5 months ago #12930 by vlad91
Replied by vlad91 on topic Delete highlight from page
I used OpenMem, that was causing my problems, hopefully it will be smooth sailing from now on. Cheers!
More
IP: 82.79.210.227 5 years 3 months ago #15355 by razvar
Replied by razvar on topic Delete highlight from page
Sorry to revamp this thread, but I'm having the same issue: I can't remove highlight annotations unless the file is loaded from disk and not from memory stream. The thing is that it works to add annotations while pdf loaded from memory stream as documented here: www.radaeepdf.com/support/knowledge-base?view=kb&kbartid=54 . But I can't remove them back once added (unless I re-reopen the document/recreate the objects, but that's not an option for a simple highlight removal to reload the entire document ).

Is there any other way around this? Since I can add them while loaded in memory I should be able to also remove them. But no way to remove them back (RemoveFromPage / removeAnnot just returns false and it's not removed unless pdf is loaded from disk storage). I've also tried using SetCache while document loaded from memory stream, but that doesn't help; as soon as document is opened from disk tho, removing annotation will work as it should.

Thanks.
More
IP: 47.240.46.43 5 years 3 months ago - 5 years 3 months ago #15356 by radaee
Replied by radaee on topic Delete highlight from page
the PDF file will be always readonly, if using Document.OpenMem() open PDF file.

but, you can use Document.OpenStream() with com.radaee.util.PDFMemStream object to open PDF.
int this way, the PDF file can read/write, and also can save.
after Document.Save() invoked, the saved data can be got by PDFMemStream.get_data() and PDFMemStream.get_size();
Last edit: 5 years 3 months ago by radaee.
More
IP: 82.79.210.227 5 years 3 months ago #15357 by razvar
Replied by razvar on topic Delete highlight from page
Thanks a lot! That helped a lot tracking this down. It was my fault, as I was already using/implementing PDFStream but forgot to return from writable override true, I was always returning false, thus marking the PDFStream as read only. So, just returning true instead of false on my PDFStream implementation, made it work as it should:
Code:
//PDF Stream Interface @Override public boolean writeable() { return true; //return true here or else the annoations created with page.AddAnnotMarkup can't be removed with Annotation.RemoveFromPage() }

Thanks again!
Time to create page: 0.450 seconds
Powered by Kunena Forum