Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

copying text with atributes between textframes

Participant ,
Jan 30, 2021 Jan 30, 2021

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
3.3K
Translate
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
Community Expert ,
Jan 30, 2021 Jan 30, 2021

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;


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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

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

Translate
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
Community Expert ,
Jan 30, 2021 Jan 30, 2021

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;

Translate
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

unfortunately, indexes (subscript, superscript) do not pass

Translate
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
Community Expert ,
Jan 31, 2021 Jan 31, 2021

Can you share the file with us?

Translate
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

ofcourse

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

Translate
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
Community Expert ,
Jan 31, 2021 Jan 31, 2021

You can share the PDF file with Tools > Share

Translate
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

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

 

Translate
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
Community Expert ,
Jan 31, 2021 Jan 31, 2021

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.

Translate
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

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

Translate
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

sorry

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

Translate
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
Community Expert ,
Jan 31, 2021 Jan 31, 2021

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.

Translate
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

oh, thanx

I will check it again 🙂

Translate
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

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?

Translate
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
Community Expert ,
Jan 31, 2021 Jan 31, 2021

So it works in Reader but not in a browser?

Translate
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

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

Translate
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
Community Expert ,
Jan 31, 2021 Jan 31, 2021

Sorry, I don't follow... So it does work when you apply it to the richValue property? If so, then what's the problem?

Translate
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

i.richValue NOT work at all (without indexes) for a variable of t15a3 (text frame)

It works properly for a variable of t3 (Array)

Translate
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
Community Expert ,
Feb 08, 2021 Feb 08, 2021

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

Translate
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

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

Translate
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

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

Translate
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

... to which I can attach a PDF

Translate
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

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.

Translate
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

 

🙂 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 🙂

Translate
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