Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Watermark PDF for first page only

Avatar

Level 2

Hi All,

I searched in the DDXRef.pdf for watermarking for first page, but unable to find, there were "none", "oddpage", and "evenpage" is available.

Could someone advise with example of DDX, which can apply watermarking for first page of the PDF.

Either in <Header> or <Watermark> or <Background>. 

Shaji

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@Shaji_KGL 

Watermarking and page content consider an alternation attribute ONLY in a DDX i.e apply to all pages or to alternating pages (all odd or even pages) in a source document. 

You may add a blank page with a watermark as the first page OR use the first page as a separate input doc with the watermark applied to the same.

<PDF result="out.pdf">
<BlankPage forceEven="true">
<Watermark>
<StyledText font-family="Helvetica" font-size="14">
<p>This is for testing purpose</p>
</StyledText>
</Watermark>
</BlankPage>
<PDF source="Input1.pdf"/>
<PDF source="Input2.pdf"/>
</PDF>


OR


<PDF result="out.pdf">
<PDF source="FirstPage.pdf"/>
<Watermark>
<StyledText font-family="Helvetica" font-size="14">
<p>This is for testing purpose</p>
</StyledText>
</Watermark>
<PDF source="Input1.pdf"/>
<PDF source="Input2.pdf"/>
</PDF>

 

 

View solution in original post

7 Replies

Avatar

Correct answer by
Employee Advisor

@Shaji_KGL 

Watermarking and page content consider an alternation attribute ONLY in a DDX i.e apply to all pages or to alternating pages (all odd or even pages) in a source document. 

You may add a blank page with a watermark as the first page OR use the first page as a separate input doc with the watermark applied to the same.

<PDF result="out.pdf">
<BlankPage forceEven="true">
<Watermark>
<StyledText font-family="Helvetica" font-size="14">
<p>This is for testing purpose</p>
</StyledText>
</Watermark>
</BlankPage>
<PDF source="Input1.pdf"/>
<PDF source="Input2.pdf"/>
</PDF>


OR


<PDF result="out.pdf">
<PDF source="FirstPage.pdf"/>
<Watermark>
<StyledText font-family="Helvetica" font-size="14">
<p>This is for testing purpose</p>
</StyledText>
</Watermark>
<PDF source="Input1.pdf"/>
<PDF source="Input2.pdf"/>
</PDF>

 

 

Avatar

Employee

@Shaji_KGL, Pulkit gave you a good example if you have several documents and the first page comes as an individual PDF. If your document is in one PDF with multiple pages you could try this here:

<DDX xmlns="http://ns.adobe.com/DDX/1.0/">

<PDF result="outDoc">

   <PDF source="input" pages="1">

      <Watermark rotation="45" opacity="60%">

        <StyledText color="red" font-size="72pt"><p>Adopted!</p></StyledText>

      </Watermark>

   </PDF>

   <PDF source="input" pages="2-last"/>

</PDF>

</DDX>

Avatar

Level 2
Hi Kosta_Prokopiu, I have deployed in live, one issue came up, if there is only 1 page article, its throwing error this is due to "2-last", I tried to change it to "1-last" but its duplicating first page and adding as second page.

Avatar

Employee
@Shaji_KGL, ah ok, yes that example was under the assumption that your documents have usually more than 1 page. I will see how you can approach this. Do you have a custom service or orchestration and do you know how much pages the pdf has before you construct the DDX? In that case you could control it by code. When I have some time I will look how this could be overcome.

Avatar

Level 2
Thanks for immediate response, according to pages, it will be minimum 1 but maximum we cannot define, since articles will have 25, 30 etc... so we cannot fix the pages, if its 1 page or multiple page, its need to add accordingly. We are configured as "watchfolder".