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

Automatically add a watermark when exporting to a PDF

New Here ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

Hi, happy new year everyone!

I just wanted to know if there is a plugin or a way to automatically add a watermark when I export the document.

Or maybe automatically creating a new layer (locked if possible) with a text or an illustration when you create a new document.

Thank you!

Views

23.1K

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

Community Expert , Jan 24, 2019 Jan 24, 2019

Try the following

var myDoc = app.activeDocument, 

myPdfExportPreset = "[Smallest File Size]",

myPdfFile = File(myDoc.fullName.fsName.replace(/.indd$/i, "") + ".pdf");   

app.scriptPreferences.measurementUnit = MeasurementUnits.PICAS

var docHeight = myDoc.documentPreferences.pageHeight

var docWidth = myDoc.documentPreferences.pageWidth

with ( myDoc.watermarkPreferences ) 

    { 

        watermarkVisibility = true;   

        watermarkDoPrint = true;   

        watermarkDrawInBack = true;   

        w

...

Votes

Translate

Translate
Community Expert ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

Can't you just add it to a master page and turn it on when you need it on the exported to PDF document?

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

I was thinking about it but I wanted to know if there is a way to do it automatically, we are making many indd projects per day in the agency where I work and I'm sure one day we will forget to put the watermark and we will fall on a client who send a low-res project to the print worker...

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

Automatically? No!

I suppose it could be scripted but, if you can’t remember to turn on a layer before outputting a PDF, you’re going to forget to run the script, too.

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

You can apply a watermark in Acrobat after you've made the PDF. Add watermarks to PDFs in Adobe Acrobat DC

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

Acrobat Pro has Actions, and if you have questions about how to create one, please ask in the Acrobat forum.

Your Action can include adding a watermark, setting options for opening the document, security, running Javascript, etc. You have the option to do it automatically or to review and customize each step.

You might do both:

Create and enable layer, and if you forget, apply it in Acrobat after the fact. You have to decide what works for your workflow.

Setting Layer Options could also work: Printable but not visible. Be sure to Export All Layer as part of your Saved PDF Preset.

All of these require a human making sure the watermark is there. You could check the Scripting forums.

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

I agree with Eugene and Jane: It would be a lot easier to create an Action in Acrobat Pro. Then you could apply it to as many PDFs as you like, all at one time.

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

Hi,

Or using The Force!  At your own risks! …

Supposing the personal pdf export preset you've saved and want to use here is: "Print_WithoutCropMarks" …

ID file before:

Capture d’écran 2017-01-04 à 20.42.21.png

1 light-saber hit with this code:

var myDoc = app.activeDocument,

myPdfExportPreset = "Print_SansHir",

myPdfFile = File(myDoc.fullName + ".pdf"); 

with ( myDoc.watermarkPreferences )

    {

        watermarkVisibility = true; 

        watermarkDoPrint = true; 

        watermarkDrawInBack = true; 

        watermarkText = "HAPPY NEW YEAR!  (^/)"; 

        watermarkFontFamily = "Arial"; 

        watermarkFontStyle = "Bold"; 

        watermarkFontPointSize = 65; 

        watermarkFontColor = [180,180,180];  

        watermarkOpacity = 60; 

        watermarkRotation = -45; 

        watermarkHorizontalPosition = WatermarkHorizontalPositionEnum.watermarkHCenter; 

        watermarkHorizontalOffset = 0; 

        watermarkVerticalPosition = WatermarkVerticalPositionEnum.watermarkVCenter; 

        watermarkVerticalOffset = 0; 

    }

myDoc.asynchronousExportFile(ExportFormat.PDF_TYPE, myPdfFile, false, myPdfExportPreset);

myDoc.watermarkPreferences.watermarkVisibility = false;

PDF file:

Capture d’écran 2017-01-04 à 20.40.37.png

ID file after -- no changes!:

Capture d’écran 2017-01-04 à 20.42.21.png

So, … HAPPY NEW YEAR TO ALL!

(^/) 

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

Happy new year to you too Obi.

I wonder what your real name is, maybe it's something like Les Braithwaite – any other suggestions?

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

"Ben" comes to mind as an alternate name!

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 ,
Jan 04, 2017 Jan 04, 2017

Copy link to clipboard

Copied

Yeap! you can call me Ben too! 

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 ,
Jan 05, 2017 Jan 05, 2017

Copy link to clipboard

Copied

Hey thanks, that might do it, the force is strong in you!

Thank you all for all the answers, I will try some of them

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 ,
Jan 05, 2017 Jan 05, 2017

Copy link to clipboard

Copied

Happy new year, Obi-wan!

InDesign's "Watermark" is another one of the unfinished features, that did not make it to the UI.

And it comes with some restrictions:

1. It's a global preference for the whole document (or the application).

You cannot define different watermarks for different pages. spreads, sections or alternate layouts.

2. The watermark text can be only one line of text. No chance to break the text to two or more lines.

If you try by using:

watermarkText = "Watermark first line"+"\n"+"second line";

or:

watermarkText = "Watermark first line"+"\r"+"second line";

you will get something like that:

Watermark-FirstLine-NoSecondLine.png

Using a tabulator in the text?

watermarkText = "Draft-1"+"\t"+"Today";


No chance:

NoTabAllowed.png

3. The view of the pages in the pages panel is not updating instantly if you change the contents of watermarkText.

1-Draft-1.png

Adding a rectangle on page 1 and run a script to change watermarkText to "Draft-2".

The pages reflect the change. The pages in the Pages panel do not:

2-Draft-2.png

Now I changed the width of the rectangle on page 1.

The new watermarkText contents is changing for the spread of page 1 showing in the Pages panel as well.

Not so with the other spreads showing in the panel.

3-Draft-2.png

Best is to change the text of watermarkText, save, close and reopen the document to get the Pages panel fully updated.

Or to change the viewing size of the pages in the panel after changing the contents of watermarkText.

Regards,
Uwe

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 ,
Jan 05, 2017 Jan 05, 2017

Copy link to clipboard

Copied

Hi Uwe,

Sure! … but if you only wanna wish an "Happy New Year!" … or tell your client "Don't forget to pay my bill! …", it could be enough! 

(^/)

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 ,
Jan 24, 2019 Jan 24, 2019

Copy link to clipboard

Copied

Quick question ... but first I wanted to thank you for this amazing script, it super helpful! Is there a way to do it as a percentage of document size rather than point size? Also it exports as filename.indd.pdf is there a way to get rid of the".indd" part? Thanks again! This is great!

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 ,
Jan 24, 2019 Jan 24, 2019

Copy link to clipboard

Copied

Try the following

var myDoc = app.activeDocument, 

myPdfExportPreset = "[Smallest File Size]",

myPdfFile = File(myDoc.fullName.fsName.replace(/.indd$/i, "") + ".pdf");   

app.scriptPreferences.measurementUnit = MeasurementUnits.PICAS

var docHeight = myDoc.documentPreferences.pageHeight

var docWidth = myDoc.documentPreferences.pageWidth

with ( myDoc.watermarkPreferences ) 

    { 

        watermarkVisibility = true;   

        watermarkDoPrint = true;   

        watermarkDrawInBack = true;   

        watermarkText = "HAPPY NEW YEAR!  (^/)";   

        watermarkFontFamily = "Arial";   

        watermarkFontStyle = "Bold";   

        watermarkFontPointSize = Math.round(docWidth/2);   

        watermarkFontColor = [180,180,180];    

        watermarkOpacity = 60;   

        watermarkRotation = -45;   

        watermarkHorizontalPosition = WatermarkHorizontalPositionEnum.watermarkHCenter;   

        watermarkHorizontalOffset = 0;   

        watermarkVerticalPosition = WatermarkVerticalPositionEnum.watermarkVCenter;   

        watermarkVerticalOffset = 0;   

    } 

 

 

myDoc.asynchronousExportFile(ExportFormat.PDF_TYPE, myPdfFile, false, myPdfExportPreset); 

 

 

myDoc.watermarkPreferences.watermarkVisibility = false;

Line 6 and 7 gives the document height and width in PICAS and line 16 sets the fontsize of the watermark. I have set the size to 50% of docWidth you can change the calculation with what you need.

-Manan

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 ,
Jan 24, 2019 Jan 24, 2019

Copy link to clipboard

Copied

Thanks this is perfect!!!!! Exactly what i wanted it to do!!! I cant thank you enough!!!

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 ,
Jun 13, 2019 Jun 13, 2019

Copy link to clipboard

Copied

Hi! Awesome script that works great. But is there a way to change where the file export to?

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 ,
Jun 13, 2019 Jun 13, 2019

Copy link to clipboard

Copied

Change  line no. 3 and give it the full path of the file to which you want to export. Something like the following

myPdfFile = File("~/Desktop/abc.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
New Here ,
Jun 13, 2019 Jun 13, 2019

Copy link to clipboard

Copied

Aha, thanks. But do I have to name the file in that case, or is there a way to make it keep the indd-files name?

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

Copy link to clipboard

Copied

If you want to use the filename of the indesign document, then you could use the following

File("/The folder to the location where you want to save the pdf/" + myDoc.name.replace(/.indd$/i, "") + ".pdf");

Change the first part of the string above with the path of the folder where you want to save the pdf.

-Manan

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 ,
Oct 09, 2019 Oct 09, 2019

Copy link to clipboard

Copied

How do you add line breaks to the watermarkText? I've been trying \n and \r with no success.

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

Hi Manan, 

the watermark only shows up over text. If my pdf has imagery or a background the watermark is hidden behind it. Is there a way to make it sit on top of the whole artwork? Would i need to flatten the imagery in the export?

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 ,
Feb 29, 2020 Feb 29, 2020

Copy link to clipboard

Copied

Hi,

 

I don't see any property to fix this, see the properties that are accessible to us via scripting

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#WatermarkPreference.html#d1e411214

 

Seems this is one of the half baked implementation of watermark as point out by Uwe in a post above.

 

-Manan

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 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

LATEST

Is it possible to convert the watermark to outlines? 

 

When my client attempts to place comments on the PDF to communicate edits to me they are unable to select the text of the document because they are selecting the watermark in front of the text they are indending on highlighting for edits.

 

I am guessing if it is converted to outlines that would eliminate the problem because in the past i have placed a JPEG graphic of the word  "PROOF" across the pdf and it was not selectable

 

scott

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