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

PDF Formular Textfeld Zeichen ersetzen

New Here ,
Dec 09, 2021 Dec 09, 2021

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.

TOPICS
Edit and convert PDFs , PDF forms

Views

257

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
Community Expert ,
Dec 10, 2021 Dec 10, 2021

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?

Votes

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
New Here ,
Dec 12, 2021 Dec 12, 2021

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.

 

Votes

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
Community Expert ,
Dec 13, 2021 Dec 13, 2021

Copy link to clipboard

Copied

LATEST

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.

Votes

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