copying text with atributes between textframes

Participant ,
Jan 30, 2021 Jan 30, 2021

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?

TOPICS
How to, JavaScript, PDF forms, Rich media and 3D

Views

211

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 30, 2021 Jan 30, 2021

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;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 30, 2021 Jan 30, 2021

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 30, 2021 Jan 30, 2021

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;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

unfortunately, indexes (subscript, superscript) do not pass

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

Can you share the file with us?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

ofcourse

I just don't know how to attach a pdf 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

You can share the PDF file with Tools > Share

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

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 😞

Krzysztof16B8_0-1612111543481.png

I don't know what this program wants

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 31, 2021 Jan 31, 2021

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

sorry

the .richValue command works when getting information from the table (t3),

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 31, 2021 Jan 31, 2021

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

oh, thanx

I will check it again 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

So it works in Reader but not in a browser?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2021 Jan 31, 2021

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 31, 2021 Jan 31, 2021

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2021 Feb 08, 2021

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)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

Does you access the values with .value or .richValue ?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

in my opinion - yes 🙂
how to share pdfa?
it does not work out 😞

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

please give me your e-mail address to which you can attach a PDF

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

... to which I can attach a PDF

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 08, 2021 Feb 08, 2021

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2021 Feb 08, 2021

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 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines