- Posts: 9
- Thank you received: 0
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
Get object identifier (object number and generation number) with radaee API
IP: 82.84.70.123
6 years 3 months ago #14760
by Soldan
Hi,
I need to extract the object identifier, defined as object number plus generation number in the pdf specification, from an annotation.
Is there a way to do this with your API?
I noticed that (m_annot is a Page.Annotation):
final long refAnnot = m_annot.GetRef();
returns a long, so I supposed that object and generation number could be in there.
I tried:
final long genNum = (refAnnot & 0xFFFF0000) >> 32;
final long objNum = refAnnot & 0x0000FFFF;
and actually I can get the same object and generation number that I can read from the pdf file.
But the method GetRef is not documented
www.radaeepdf.com/documentation/javadocs...tation.html#GetRef--
so can I suppose GetRef returns a long with the generation number into the most significant bits 32 bits and the object number in the 32 less significant bits?
Is there a more friendly way to do this? Is my method reliable or could be any edge case?
Thank you so much
I need to extract the object identifier, defined as object number plus generation number in the pdf specification, from an annotation.
Is there a way to do this with your API?
I noticed that (m_annot is a Page.Annotation):
final long refAnnot = m_annot.GetRef();
returns a long, so I supposed that object and generation number could be in there.
I tried:
final long genNum = (refAnnot & 0xFFFF0000) >> 32;
final long objNum = refAnnot & 0x0000FFFF;
and actually I can get the same object and generation number that I can read from the pdf file.
But the method GetRef is not documented
www.radaeepdf.com/documentation/javadocs...tation.html#GetRef--
so can I suppose GetRef returns a long with the generation number into the most significant bits 32 bits and the object number in the 32 less significant bits?
Is there a more friendly way to do this? Is my method reliable or could be any edge case?
Thank you so much
IP: 111.196.244.148
6 years 3 months ago - 6 years 3 months ago #14767
by radaee
Replied by radaee on topic Get object identifier (object number and generation number) with radaee API
dear user, this method is reliable.
it is not the only way. and this function mainly used in operation stack.
acturally, Annotation.GetRef() is same to Annotation.Advance_GetRef();
we wrap 2 methods with same return value, because we hope use different method on different occasion.
and, we not mention about this, because the return value mainly used in inner class.
you are right for codes:
at last, i shall say: all Advance_GetRef() in Document, Page, Annotation return the same.
it is not the only way. and this function mainly used in operation stack.
acturally, Annotation.GetRef() is same to Annotation.Advance_GetRef();
we wrap 2 methods with same return value, because we hope use different method on different occasion.
and, we not mention about this, because the return value mainly used in inner class.
you are right for codes:
Code:
final long genNum = (refAnnot & 0xFFFF0000) >> 32;
final long objNum = refAnnot & 0x0000FFFF;
at last, i shall say: all Advance_GetRef() in Document, Page, Annotation return the same.
Last edit: 6 years 3 months ago by radaee.
IP: 88.36.189.149
6 years 3 months ago #14769
by Soldan
Replied by Soldan on topic Get object identifier (object number and generation number) with radaee API
Ok, thank you so much.
If the code is reliable I think I'll use
Thanks
If the code is reliable I think I'll use
Code:
final long refAnnot = m_annot.GetRef();
final long genNum = (refAnnot & 0xFFFF0000) >> 32;
final long objNum = refAnnot & 0x0000FFFF;
IP: 94.36.86.133
6 years 2 weeks ago - 6 years 2 weeks ago #14927
by Soldan
Replied by Soldan on topic Get object identifier (object number and generation number) with radaee API
Hi,
I've been thinking about the above code after a while. Could it be that it is wrong?
In fact I'm doing a bitwise AND between refAnnot which is 64 bits and 0xFFFF0000 / 0x0000FFFF which are 32 bit right?
So I guess that the right code should be
Am I right?
Thanks
I've been thinking about the above code after a while. Could it be that it is wrong?
In fact I'm doing a bitwise AND between refAnnot which is 64 bits and 0xFFFF0000 / 0x0000FFFF which are 32 bit right?
So I guess that the right code should be
Code:
final long refAnnot = m_annot.GetRef();
final long genNum = (refAnnot & 0xFFFFFFFF00000000L) >> 32;
final long objNum = refAnnot & 0x00000000FFFFFFFFL;
Am I right?
Thanks
Last edit: 6 years 2 weeks ago by Soldan.
IP: 111.196.244.252
6 years 2 weeks ago #14928
by radaee
Replied by radaee on topic Get object identifier (object number and generation number) with radaee API
seems ok, but i think following codes are better:
if genNum is less than 0, your codes may run not correctly, but seems never happen.
Code:
final long refAnnot = m_annot.GetRef();
final long genNum = (refAnnot >> 32) & 0x00000000FFFFFFFFL;
final long objNum = refAnnot & 0x00000000FFFFFFFFL;
IP: 94.36.86.133
6 years 2 weeks ago #14931
by Soldan
Replied by Soldan on topic Get object identifier (object number and generation number) with radaee API
I think that the pdf specification defines genNum as greater or equal than zero. So it shouldn't be less than 0.
Time to create page: 0.417 seconds