Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

how to turn multiple text boxes into multi-line boxes without redoing everything

Community-Einsteiger ,
Dec 31, 2024 Dec 31, 2024

Help!

Every time I think I'm on the last steps of this project I end up coming across an issue that requires me to backtrack and do several hours worth of work from scratch again.

Please tell me it's possible somehow to change all the text boxes in a document to multiline boxes? I have a 605 page document and as I was finalizing I realized that the boxes that need to be multi-line, aren't. While lots don't need to be multiline, I'd rather convert the entire project than have to redo many hours worth of work.

THEMEN
PDF-Dateien erstellen , PDF-Dateien bearbeiten und konvertieren , Allgemeine Fehlerbehebung , Anleitungen , JavaScript , PDF , PDF Forms
1.2K
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

It might be possible, if the fields can be identified as belonging to one group. Do their borders overlap with each other, or do they share a similar name (such as Text1A, Text1B, Text1C, which should be merged as Text1)? If not, it will be difficult to write a script that would do it without messing up a bunch of other fields...

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Dec 31, 2024 Dec 31, 2024
They don't share the same or similar names... I just want to change all
single line text fields to multi-line text fields.
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jan 01, 2025 Jan 01, 2025

Ah, that's easily done. Run this code from the JS Console:

 

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 = true;
}
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Jan 02, 2025 Jan 02, 2025
AKTUELL
Thank you! I ended up doing it with code someone else posted here earlier.
I really appreciate it!!!
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

You can run a script in the console to change all text fields to multi-line text fields.  Is that what you want?  Probably not.  You can run a height test on the fields and only change to mult-line if they exceed a certain height.  This might be a better way to go.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Dec 31, 2024 Dec 31, 2024
I do think this is probably the best option for my needs. Every text box is
either a date text box, a single line or a large box. I don't see any harm
in changing them all to multi-line boxes do you? For reference it's for a
workbook/journal/daily schedule style book and this is the beta test
version of it.
I don't know anything about writing code though.
But yes, your idea of writing into the code only if it's a text box above a
certain height would also work (anything above the standard text box
height).
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

There are problems with converting text fields to mult-line that do not need to be mult-line (font size set to auto could end up being too small, for example).  Here's how to do it with a height test.

Find a text field in your document with a maximum height that should not be a mult-line field.  Run the following script in the console (assuming the name of the field is "Text1"):

var rc=this.getField("Text1").rect; rc[1]-rc[3];

The script above will return the height in points.  If it has a large number of decimal places, simply round up to a whole number.  Assume it returns 18 (1/4 inch) for this example, run the following script in the console:

 

 

 

for(var i = 0; i< this.numFields; i++)
{
var fName = this.getNthFieldName(i);
var oFld=this.getField(fName);
if(oFld==null){continue}
if(oFld.type=="text")
{
var rc=oFld.rect;
var height=rc[1]-rc[3];
if(height>18)//Change 18 to the height you need.
{
oFld.multiline=true;
}
}
}

 

 

 

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Dec 31, 2024 Dec 31, 2024
OMG THANK YOU!!!!!!
Seriously THANK YOU. I haven't tested every page or anything but it looks
like this worked!!! Truly feels like a miracle today with how this project
has gone so far haha. Thank you soo so much.
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines