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

Insert Blank page that has watermark of "This page is intentionally left blank" on odd page documents.

New Here ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

I am using Action Wizard to insert blank pages on odd page documents. In the past i used a script that found a file path to a document that says "this page is intentionally left blank", but i would like to build a script that adds a watermark to the new blank page that says the same thing. Below are the two scripts i found but i am unsure how to make them work together. I am new to javascript and im not sure if this is even possible or if im doing everything the hard way. Thanks for the help

Script 1:

if (this.numPages % 2) {

    this.newPage();

}

Script 2:

this.addWatermarkFromText({

cText: "This\n\nPage\n\n\n\nIs\n\nIntentionally\n\nLeft\n\nBlank",

nTextAlign:app.constants.align.center,

cFont: "Helvetica-Bold",

nFontSize:36,

aColor: color.red,

nStart: this.pageNum,

nOpacity: 0.5

});

TOPICS
Acrobat SDK and JavaScript

Views

1.2K

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

LEGEND , Sep 11, 2018 Sep 11, 2018

Try this code in the JavaScript console and then add it to an Action and be sure to save the file at the end of the action.

if (this.numPages % 2) {

    this.newPage();

    //

    this.addWatermarkFromText({

    cText: "This\n\nPage\n\nIs\n\nIntentionally\n\nLeft\n\nBlank",

    nTextAlign:app.constants.align.center,

    cFont: "Helvetica-Bold",

    nFontSize:36,

    aColor: color.red,

    nStart: this.numPages - 1,

    nOpacity: 0.5

    });

} // end if odd number of pages;

Votes

Translate

Translate
LEGEND ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

Have you tried to open a PDF document and run the scripts?

Have you looked at the Acrobat JavaScript API Reference for the newPage and addWaterMarkFromFile?

By default the newPage will be inserted at the end of the PDF but the viewed or focused page will the first page. The watermark can be applied to any page or a range of pages. Your script specifies the currently focused page, so you have to change this to specify the last page. You would also need to include adding the watermark to the block of code within the if statement for the odd number of pages or it will add the watermark to the last page of PDFs with an even number of pages.

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 ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

Thanks that all makes sense and i see the issues. Just having trouble writing it together.

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
LEGEND ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

Try this code in the JavaScript console and then add it to an Action and be sure to save the file at the end of the action.

if (this.numPages % 2) {

    this.newPage();

    //

    this.addWatermarkFromText({

    cText: "This\n\nPage\n\nIs\n\nIntentionally\n\nLeft\n\nBlank",

    nTextAlign:app.constants.align.center,

    cFont: "Helvetica-Bold",

    nFontSize:36,

    aColor: color.red,

    nStart: this.numPages - 1,

    nOpacity: 0.5

    });

} // end if odd number of pages;

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 ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

LATEST

That works like a charm!!  Thanks again for the help

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