-
1. Re: Certain FreeText attributes don't seem to work in this.addAnnot
GKaiseril Aug 26, 2012 8:33 AM (in response to DHeadrick)What is the size and location of your annotation?
What are the values for LLX, LLY, URX, and URY?
What is the size of the PDF page?
Is the PDF page rotated?
Have you tried making the annotation and then modifying it?
-
2. Re: Certain FreeText attributes don't seem to work in this.addAnnot
DHeadrick Aug 26, 2012 9:49 AM (in response to GKaiseril)Hi,
Thanks for your reply.
The issue I'm observing is independent of the size and location of the annotation. Stated another way, it's independent of the values of LLX, LLY, URX, and URY. I would be glad to generate some values for these parameters if you'd like.
Your other questions are more interesting. The page *is* rotated and it's a size B (aka tabloid, aka 11"x17") page. So, it's in landscape mode, with the 17" dimension running horizontally. This means, as I understand it, the origin for specifying the text box dimension is in the upper left corner, with Y running down (vertically) and X running right (horizontally). Using this coordinate system, I never have any trouble creating a text box anywhere I want on the page, of any size. It's what's in the text box that's the problem.
You ask "Have you tried making the annotation and then modifying it?" Maybe I'm misunderstanding your question, but that's what I'm doing. I create the annotation with this.addAnnot and then modify it (in particular, the textSize and contents) after I create the annotation. If I create textSize or contents within the this.addAnnot, they either have no affect or they do unexpected things, like generating red text. If i create textSize or contents outside of the this.addAnnot, it always works fine.
If I do both (create textSize and contents within this.addAnnot, which doesn't work), and then modify it subsquently, that also works fine. In this case, whatever textSize and contents are specified within this.addAnnot becomes a "don't care" since I specify (override) these values afterwards. So, it's cleaner to just specify textSize and contents in one spot, namely outside of and after the this.addAnnot.
Thanks for any further insights you have on why (it appears) I can't specify textSize and contents within this.addAnnot. Also, any insights on why it appears that "alignment" is completely non-functional would be appreciated as well.
Dave
-
3. Re: Certain FreeText attributes don't seem to work in this.addAnnot
GKaiseril Aug 26, 2012 11:15 AM (in response to DHeadrick)A check of the documentation for the add annotation action shows the centered property does not have a value option of the character string "centered", it has values of 0, 1, and 2.
-
4. Re: Certain FreeText attributes don't seem to work in this.addAnnot
DHeadrick Aug 26, 2012 11:25 AM (in response to GKaiseril)In my original posting, I stated: "BTW, I've tried both "center" and the value 1 for alignment, but it's always left aligned."
Do you have any ideas why none of this (seems to) work? Specifically, why I can't specify textSize and contents with the this.addAnnot and why alignment doesn't work at all?
Thanks again.
Dave -
5. Re: Certain FreeText attributes don't seem to work in this.addAnnot
GKaiseril Aug 26, 2012 11:34 AM (in response to DHeadrick)The user interface is now different than it was in Acrobat version 5 and the example from the version 5 JavaScript documentation does not work as illustrated.
-
6. Re: Certain FreeText attributes don't seem to work in this.addAnnot
DHeadrick Aug 26, 2012 11:49 AM (in response to GKaiseril)I never mentioned Acrobat version 5. I did mention that I'm using Acrobat 9. What "example from the version 5 JavaScript" are you referring to?? And how would this be relevant to my question regarding Acrobat 9?
Basically, I'm still no closer to understanding why I'm experiencing these problems on Acrobat 9. Do you have any ideas on this?
-
7. Re: Certain FreeText attributes don't seem to work in this.addAnnot
GKaiseril Aug 26, 2012 4:51 PM (in response to DHeadrick)You have provided incomplete code and code with an obvious error, but maybe not a script ending error.
The 'alignment' property has been depreciated since it was introduced.
Here is the page from the version 5 JS refer
With only partial code and an obvious coding value error, it is possible you have code elsewhere that could have corrupted the code you are trying to use.
Yes one can redefine a property or method in JavaScript.
-
8. Re: Certain FreeText attributes don't seem to work in this.addAnnot
GKaiseril Aug 27, 2012 7:21 AM (in response to GKaiseril)You could write your script in the following manner:
var LLX = 25; LLY = 25; URX = 100; URY = 100;
var MyRect = this.addAnnot ( { page: 0,
type: "FreeText",
width: 1,
rect: [ LLX, LLY, URX, URY] })
MyRect.textSize = 25;
MyRect.contents = "ABC";
So you are setting the content after the comment object has been established.If you think this is an error, then you should file a bug report with Adobe.
-
9. Re: Certain FreeText attributes don't seem to work in this.addAnnot
DHeadrick Sep 6, 2012 5:36 AM (in response to GKaiseril)I couldn't find any evidence that the 'alignment' property has been deprecated, at least in Acrobat 9. It was introduced in Acrobat 5 and still seems to be supported. I think it's fair to conclude that this property just doesn't work.
Your example script is exactly what I've been doing, namely putting 'textSize' and 'contents' outside of the this.addAnnot. My original question from my first posting was:
"Can someone tell me if textSize and contents truly have to be outside of this.addAnnot in
order to work correctly?"I'll take your answer as confirmation that this is, in fact, what I need to do. I presume this is a bug but perhaps Adobe would claim "This is just how it works".
Thanks for your help.
Dave
-
10. Re: Certain FreeText attributes don't seem to work in this.addAnnot
GKaiseril Sep 6, 2012 8:08 AM (in response to DHeadrick)The not working is the depreciation, but it does not throw an error and stop the script.
Some times one needs to have an object created and established before modifying certain propertites or using certain methods.
-
11. Re: Certain FreeText attributes don't seem to work in this.addAnnot
trentnielson Mar 25, 2013 4:33 PM (in response to DHeadrick)Did you ever figure out how to get alignment to work? I'm struggling with this right now.



