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

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

Explorer ,
Mar 14, 2019 Mar 14, 2019

Copy link to clipboard

Copied

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

Views

1.0K

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

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

Votes

Translate

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

Copy link to clipboard

Copied

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", "")

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

Copy link to clipboard

Copied

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", "")

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

Use this:

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

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

}

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

Copy link to clipboard

Copied

LATEST

Danke viel Mal

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

Copy link to clipboard

Copied

You can use:

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

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

Copy link to clipboard

Copied

Thank you very much, it worked out great greetings

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