Determine if Text or Box is rotated for Annotation?

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Determine if Text or Box is rotated for Annotation?

Post by whoit »

Hi -

I have been given a PDF that includes several Comments of this kind : pxInst.StrToAtom("Square")

Some of the comments are rotated (or their content is, I'm not certain which)
For example, when opening the PDF, most comments are normal - that is, horizontal just like this text.
Some are vertical though - as though either the box or the contents were rotated 90 degrees.

I've tried comparing height/width but that doesn't always work....it may work for a single word or line of text
PIC 1:
Image


but does not work if the text is in a tall rectangle.
PIC 2:
Image




When I get the Annotation object, is there a way to determine if it is rotated?
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Tracker Supp-Stefan »

Hello whoit,

I believe this is the one you need to determine if an annotation is rotated relative to the coordinate system of the page:
https://sdkhelp.pdf-xchange.com/vi ... a_Rotation

Regards,
Stefan
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Determine if Text or Box is rotated for Annotation?

Post by whoit »

Hi Stefan -

I've tried that and all Annotations return "0".

I've previously sent a sample of this file for a different forum post - can you please check with Alex for "sample-Layout1_MONOComments.pdf"

The Annotation in question is in the original post "NORTH", which is the tenth annotation in the PDF.

Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Sasha - Tracker Dev Team »

Hello Wayne,

The North (and all of the other words like this) does have a Square annotation around it, though the Square annotations themselves do not hold the text at all. The North word (and all of the others in this document) is a Path content type item - not a part of the annotation:
Capture39.PNG
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Determine if Text or Box is rotated for Annotation?

Post by whoit »

Hi Alex -

Ok I see that, but the text itself is still part of the annotation - you can see a popup when you mouse-over.
So, I am able to get the text from the Content property.

My issue is trying to determine when the annotation is Vertical vs Horizontal, and since the rotation always shows 0,
I'm trying to find another way...

-Wayne
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Sasha - Tracker Dev Team »

Hello Wayne,

There is a popup with that value, not the annotation's text:
Capture40.PNG
What content property are you talking about? I was talking about the PDF Content. And no, in this case you won't be able to get the text - there are only Path items there - no Text content items.
Also, determining the Rectangle Annotation's position is futile - it won't give you any information at all.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Determine if Text or Box is rotated for Annotation?

Post by whoit »

Hi Alex -

I get the text from the Annotation.Data.Contents
and I get the rect from Annotation.Data.get_Rect()

But you're right, other than the Rect, I cannot determine if the annotation has been rotated.

That's what I'm trying to figure out....
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Well that's not the annotation's text, but an optional structure field that was filled by the document generator of some sort:
Capture41.PNG
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Determine if Text or Box is rotated for Annotation?

Post by whoit »

HI Alex -

Yes, it's the output from AutoCAD when exporting to PDF.

So I guess there is no inherent way to determine the 'visual rotation'...damn.

Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Sasha - Tracker Dev Team »

Hello Wayne,

From what I see, there is no way. Taking the rectangle's width and height won't work either, because there can be several lines of narrow text or something like that.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Determine if Text or Box is rotated for Annotation?

Post by whoit »

Yep - been down that road already.... :(
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Tracker Supp-Stefan »

Hello Whoit,

So there is no "text" as such at this position in the file.
The "North" word is path objects, and AutoCAD has included the rectangle with the pop-up text on top of those.
I remember in the past we had issues with those rectangles being visible (due to the way AutoCAD has incorrectly specified them) - so we had to make tweaks in our own code to not show those. Apparently in your case this rectangle holds the information you are extracting, but the rectangle itself is placed on top of the base content by AutoCAD as part of the PDF generation process, and as such is positioned in the correct orientation and will not report itself as an object that is rotated relative to the coordinate system of the page. So I really do not see a way you can detect that the text is rotated, when what is rotated is not text, and the object on top that contains the extractable "meaning" of the paths below is not rotated.

Regards,
Stefan
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Determine if Text or Box is rotated for Annotation?

Post by whoit »

Hi Stefan -

Yeah, that's what I was afraid of...
I was hoping it was constructed as a 'regular' annotation and the rotation was part of it.

Oh, well - I'll keep thinking...

Thanks.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Tracker Supp-Stefan »

Hello whoit,

In this particular case and file - unfortunately it is not!
Sorry that we could not help further on this one! Hope you will figure it out!

Cheers,
Stefan
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Determine if Text or Box is rotated for Annotation?

Post by whoit »

Me too!

It'll probably have to be something related to rect size and contents, although
I'm doing that now and have found issues (Alex pointed out the issue earlier...)
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Determine if Text or Box is rotated for Annotation?

Post by Tracker Supp-Stefan »

Thanks for the update Whoit,

Hope the alternative approaches you are working on will allow you to achieve the needed result!

Cheers,
Stefan
Post Reply