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

Dateiname mit Wasserzeichen ab einem bestimmten Zeichen (-) inklusive .pdf abschneiden

Explorer ,
Mar 14, 2019 Mar 14, 2019

Guten Morgen

Ich möchte gerne im Wasserzeichen den Dateinamen ohne .pdf  geschrieben haben. Ebenso gibt es manchmal, dass nach einem Bindestrich - eine oder zwei Zahlen im Dateinamen sind. diese sollten ebenfalls abgeschnitten werden. Ist nicht immer der Fall.

Die Farbe müsste rot sein, Schriftgrösse 14 und 1,5mm vom uneren Rand, vom linken Rand 10mm

Ein Beispiel: Philips_1005_2_1_1-1.pdf  Neu: Philips_1005_2_1_1

Ich danke im Voraus herzlich für eine Hilfe.

Liebe Grüsse

TOPICS
Acrobat SDK and JavaScript , Windows
1.4K
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

correct answers 1 Correct answer

Explorer , Mar 17, 2019 Mar 17, 2019

Good Morning

It does not always have a hyphen (-), the script should per PDF either this.documentFileName.replace (".pdf", "",) or this.documentFileName.split ("-") [0] Is this possible? I would be very grateful for your help.

Kind regards

Translate
Community Expert ,
Mar 15, 2019 Mar 15, 2019

You can use the addWatermarkFromText command to add the watermark, or even using a (read-only) text field or annotation.

The text itself is just a string that you can manipulate using JavaScript's built-in command from that object.

For example, to remove the ".pdf" extension you can use the following:

this.documentFileName.replace(".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
Explorer ,
Mar 15, 2019 Mar 15, 2019

You can use the addWatermarkFromText command to add the watermark, or even using a (read-only) text field or annotation.

The text itself is just a string that you can manipulate using JavaScript's built-in command from that object.

For example, to remove the ".pdf" extension you can use the following:

this.documentFileName.replace(".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
Explorer ,
Mar 15, 2019 Mar 15, 2019

Thanks for the answer. After the sign - the numbers should be cut off. Unfortunately, I can not program

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 ,
Mar 15, 2019 Mar 15, 2019

Use this:

this.documentFileName.split("-")[0]

It will also get rid of the file extension, so the other code is not needed.

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
Explorer ,
Mar 15, 2019 Mar 15, 2019

Thank you very much. I will try this on Monday. have a good weekend. Kind regards

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
Explorer ,
Mar 17, 2019 Mar 17, 2019

Good Morning

It does not always have a hyphen (-), the script should per PDF either this.documentFileName.replace (".pdf", "",) or this.documentFileName.split ("-") [0] Is this possible? I would be very grateful for your help.

Kind regards

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 ,
Mar 18, 2019 Mar 18, 2019

OK, you should have mentioned that before...

The code would be something like this, then:

if (/-/.test(this.documentFileName)) {

     // add watermark for file name with hyphen

} else {

     // add watermark for file name without hyphen

}

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
Explorer ,
Mar 18, 2019 Mar 18, 2019
LATEST

Danke viel Mal

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 ,
Mar 18, 2019 Mar 18, 2019

You can use:

this.documentFileName.replace(".pdf","").split("-")[0]

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
Explorer ,
Mar 18, 2019 Mar 18, 2019

Thank you very much, it worked out great greetings

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