Skip to main content
Inspiring
March 15, 2019
Answered

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

  • March 15, 2019
  • 2 replies
  • 1431 views

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

This topic has been closed for replies.
Correct answer bisyvo

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

2 replies

bisyvoAuthor
Inspiring
March 15, 2019

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

try67
Community Expert
Community Expert
March 15, 2019

Use this:

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

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

bisyvoAuthor
Inspiring
March 15, 2019

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

try67
Community Expert
Community Expert
March 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", "")

bisyvoAuthor
Inspiring
March 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", "")