Copy link to clipboard
Copied
Can I use the clipboard to transfer these attributes?
In JS in InDesign I select the object and use the commands: app.copy () / app.paste ().
How does this mechanism work in Acrobat?
Copy link to clipboard
Copied
It depends on what you call "attributes", but in any case JavaScript-PDF does not allow copy and paste. But of course it allows you to pass attributes from one field to another.
this.getField("A").value = this.getField("B").value;
Copy link to clipboard
Copied
I need copy texts like these: KNO2(aq) • KNO3(aq) • K2CrO4(aq) etc. (chemical formulas) with indexes upper and lower 😞
I know I can set text attributes, but I need to copy these chemical formulas exactly as they are.
I know I can set text attributes, but I need to copy these chemical formulas exactly as they are.
These are examination forms in which there are specific chemical formulas to be accurately "rewritten"
but thanks for the info
Copy link to clipboard
Copied
JS in Acrobat has no access to the clipboard. However, it can copy the contents of one field directly to another, as was mentioned before. If the fields have rich text formatting enable it can also copy those, but not all the properties. Try this code:
this.getField("A").richValue = this.getField("B").richValue;
Copy link to clipboard
Copied
unfortunately, indexes (subscript, superscript) do not pass
Copy link to clipboard
Copied
Can you share the file with us?
Copy link to clipboard
Copied
ofcourse
I just don't know how to attach a pdf 🙂
Copy link to clipboard
Copied
You can share the PDF file with Tools > Share
Copy link to clipboard
Copied
OK, one more time:
ADOBE (Acrobat, Reader):
i.value = t15a3.value; - works, but without indexes
i.richValue = t15a3.richValue; - did not work
i.richText = t15a3.richText; - did not work
i.richValue = t3; - works very well, but t3 is a handwritten array
BROWSER:
i.value = t15a3.value; - works, but without indexes
i.richValue = t3; - is not working
I can't share my pdf 😞
I don't know what this program wants
Copy link to clipboard
Copied
OK, if it works in Acrobat and in Reader but not in the browser we can't help you. The fault is clearly with the PDF plugin of the browser. Report the issue to them.
Copy link to clipboard
Copied
OK
forget about the browser 🙂
and why don't work these commands:
i.richValue = t15a3.richValue;
i.richText = t15a3.richText;
the .richText command works when getting information from the table (t3), but not when getting information from the t15a3 field (t15a1-t15a6)
it would be well if I could solve this problem for the future
Copy link to clipboard
Copied
sorry
the .richValue command works when getting information from the table (t3),
Copy link to clipboard
Copied
You need to first set the richText property, and then richValue, not the other way around.
But setting richText at all does not really have to be done, if the field is already set as having rich-text formatting. It's a one-time setting.
Copy link to clipboard
Copied
oh, thanx
I will check it again 🙂
Copy link to clipboard
Copied
these pdfs will be used interchangeably in Adobe Reader and browsers.
scripts using .richText and .richValue do not work properly in browsers
should I use JS in HTML proper syntax?
Copy link to clipboard
Copied
So it works in Reader but not in a browser?
Copy link to clipboard
Copied
Field("t15a3") has the code in operation onfocus = on
var t15a3 = this.getField("t15a3");
t15a3.richValue = true;
var t3 = new Array();
t3[0] = new Object();
t3[0].text = "K";
t3[1] = new Object();
t3[1].text = "2";
t3[1].subscript = true;
t3[2] = new Object();
t3[2].text = "CrO";
t3[3] = new Object();
t3[3].text = "4(aq)";
t3[3].subscript = true;
var k = this.getField("infoF");
if (k.value == "I: Najedź na właściwy wzór i kliknij myszą") {
var i = this.getField("t15_I");
i.value = t15a3.value;
//i.richText = true;
//i.richValue = t3;
}
else if (k.value == "II: Najedź na właściwy wzór i kliknij myszą") {
var ii = this.getField("t15_II");
ii.value = t15a3.value;
//ii.richText = true;
//ii.richValue = t3;
}
else if (k.value == "III: Najedź na właściwy wzór i kliknij myszą") {
var iii = this.getField("t15_III");
iii.value = t15a3.value;
//iii.richText = true;
//iii.richValue = t3;
}
Field("t15_I") should read the contents of the field ("t15a3") with indexes. But not read.
I'm using this piece of code temporarily: i.richValue = t3; and it works OK
Copy link to clipboard
Copied
Sorry, I don't follow... So it does work when you apply it to the richValue property? If so, then what's the problem?
Copy link to clipboard
Copied
i.richValue NOT work at all (without indexes) for a variable of t15a3 (text frame)
It works properly for a variable of t3 (Array)
Copy link to clipboard
Copied
Does you access the values with .value or .richValue ?
Copy link to clipboard
Copied
in my opinion - yes 🙂
how to share pdfa?
it does not work out 😞
Copy link to clipboard
Copied
please give me your e-mail address to which you can attach a PDF
Copy link to clipboard
Copied
... to which I can attach a PDF
Copy link to clipboard
Copied
Hmm, did you answer the question "Does you access the values with .value or .richValue ?" With "yes"? I think the posters was looking for you to say WHICH ONE you use, since only one of them can work.
Copy link to clipboard
Copied
🙂 ofcourse. sorry for my translation
var t15a3 = this.getField("t15a3");
t15a3.richValue = true;
.
.
i.value = t15a3.value;
in frame "t15a3" is chemical formula: K2CrO4(aq), but to frame "i" goes K2CrO2(aq) - without indexes
its my problem 🙂