Copy link to clipboard
Copied
Hallo zusammen,
ich benötige eine Funktion um in einem Textfeld, welches von AutoDesk Inventor mit Text befüllt wird, das Zeichen # durch ein Absatz zu ersetzen.
Beispiel:
Text1#Text2#Text3
soll
Text1
Text2
Text3
werden.
Leider habe ich bisher keinerlei Erfahrung im Bereich JavaSkript.
Kann mir bitte jemand behilflich sein, wie das Skript auszusehen hat und an welcher Stelle ich dieses einfügen müsste?
Vielen Dank im Voraus.
Copy link to clipboard
Copied
So you're importing the data from an external source and then want to convert the "#" characters into line-breaks?
Is the text field set as Multiline? Do you have Adobe Acrobat, or just the free Reader? How are you importing the data, exactly?
Copy link to clipboard
Copied
Good morning.
The textfields are filled from an external source - AutoDesk Inventor (CAD-Software).
The fields are filled correctly, but in one field a long text, currently separated by the "#" character, should be replaced by a paragraph for the next line. This field is set as Multiline.
We use Adobe Acrobat PRO DC.
The data is filled by a script provided by AutoDesk as a template. The script is called "Anark Core Script" to create a 3D-PDF. The fields must be named as follows {{ topComponent.ArtiLangTextPDF|| "" }} so that the correct texts are inserted in the appropriate place.
Copy link to clipboard
Copied
Well, you can do it using this script:
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f==null) continue;
if (f.type=="text" && f.multiline) {
f.value = f.valueAsString.replace(/#/g, "\r");
}
}
The question is how to run it. I would embed it in the file as a doc-level script, so that it runs each time the file is opened.